PDA

View Full Version : Has a select query been successful?



mud2
04-27-2005, 12:24 PM
Continuing my quest. I want to know if a value I input already exists in a table. For numerous reasons, I don't want to run a query. I have tried setting up a form (On the fly, using VBA's CreateForm), with a text box based on that query. I can then look at that text box. However, if the value is NOT in the table. the text box does not open. I do NOT want to know what is in the text box, only if it exists. But perhaps thetre is a different way: Is there a way to (vba) find out if a select query has found anything? I.e., will running a query RETURN a value?

mud2
04-27-2005, 04:33 PM
I give up! So I took the simple way...set up a DAO recordset based on the table I was querying, looped through it until(if) a match was found, and MsgBox'd if/if not a match was found.
3 months of messing around!
And there was one advantage, the search was Case dependent, whereas the Query/Form/Whatnot wasn't!

SJ McAbney
04-28-2005, 05:10 AM
Use a DLookup.

mud2
04-28-2005, 08:05 AM
The DLookup() works fine...one disadvantage, it'd case insensitive. I imagine it's faster than using VBA to loop through the whole recordset...(written in Assembly language ?)