Consulting

Results 1 to 4 of 4

Thread: Has a select query been successful?

  1. #1
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location

    Has a select query been successful?

    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?

  2. #2
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location
    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!

  3. #3
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Use a DLookup.

  4. #4
    VBAX Tutor
    Joined
    Mar 2005
    Posts
    204
    Location

    My Thanks to SJ McAbney

    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 ?)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •