Solved DAO recordset from UNION query can’t find specific record

Union queries are read only.

Re post #14, if you can do a union query then I'm sure you can do a select query based on that with a WHERE condition
For example, create a new select query something like
Code:
SELECT * FROM qryYourUnionQueryName WHERE OrderNumber = order

See SQL WHERE Clause (w3schools.com)
Thanks a bunch, I got so lost looking for an answer that I couldn't even figure how how to concatenate the SQL.
Took 5 minutes to write this reply - must be time to quick for a bit.
Thank you for helping me see the obvious.
 
We keep trying to move you away from FindFirst. But to fix the problem, try enclosing the variable in quotes.

rst.FindFirst ("WOitems = '" & shopitem & "'")

It is really hard to get a real solution when you question is about how to fix your code. If you can tell us in non-technical terms what your objective is, we can offer the best soltuion.
Pat, thank you so much for the explanation!
I tried that line probably 10 times wondering why it wouldn’t work.
the real solution was so simple I can’t believe I overlooked it.
From now on when I am having trouble I will take your advice and relay my objective so that you guys can lead me in the right direction. It always seems so easy when you pros point us amateurs in the right direction. Thank you and all that have helped me on this journey!
 
Glad hat worked.
Some advice:
Whenever you are building a string in VBA, especially for a query or just a where clause, build it into a variable. Then you can print the variable to the immediate window and immediately:) see the syntax error.
 
Glad hat worked.
Some advice:
Whenever you are building a string in VBA, especially for a query or just a where clause, build it into a variable. Then you can print the variable to the immediate window and immediately:) see the syntax error.
Been meaning to learn how to even use the immediate window. Looks like a pretty good way to not have to waste so much of you gentlemen’s time on me being stuck in the weeds. 😊
 

Users who are viewing this thread

Back
Top Bottom