Query is not running in Macro

horatiu00

New Member
Joined
Mar 23, 2022
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Hello guys, any idea why an update query is not running in macro but if i'm running it manually it works? is just one field that needs to be updated using and IIF formula.

Thank you in advance!!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Can you show us what your Macro looks like (all the steps)?
 
Upvote 0
Sure! Check below.

1659357242083.png
1659357300448.png
1659357325118.png
 

Attachments

  • 1659357220425.png
    1659357220425.png
    25.6 KB · Views: 3
Upvote 0
Are any of the other queries running in this Macro also Update Queries?
Are those other ones working?

If they are, try creating a new query where you are just running this one Update Query, and see if that works.
If it does, then it may be the order of the queries you are running in your macro, that maybe it isn't finding anything at that point in time to update.

If that is the case, maybe try create a New Macro that runs ALL the steps up to that point, and stops there.
Then, go ahead and run that.
Now see if you can run your problem Update Query manually.

If not, inspect the query to see why the conditions are not being met (something in your other queries leading up to that point is probably changing the data in a way you may not be aware of).
 
Upvote 0
Sounds good.

That is usually what I do when I have a big project with a lot of steps that is not working like I expect.
Break it down to smaller pieces and test it.
I often start of with just the first thing, and it that works, add in the next one, test it, etc.
Keep repeating those steps until you encounter the issue.
 
Upvote 0
Yes. Is a big DB with a lot of steps and the query is not running for new added records.. I was thinking to use a calculated field to replace the query but i will try with the split first.
 
Upvote 0

Forum statistics

Threads
1,224,986
Messages
6,182,154
Members
453,093
Latest member
Soffy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top