Passing SQL Query Results into a Variable Using VBA

  • Thread starter Thread starter scadav
  • Start date Start date
S

scadav

All,

It has been a long time since I did any access work, so I apologize for the
simple question:

I am trying to write some code that will do something based on whether or
not the data exists in the database. So, I basically want it to proceed
with the code provided that no rows exist in the access tables that meet
the criteria.

So I am trying to run a "select count (*) from TABLE Where COLUMN = "XYZ".
I would like to pass this value into a variable so I can create my if then
statement.

So if = 0 then continue to the next steps. If > 0, then I would like to
display the results so the user can clean them up.

Does that makes? Can anyone help me get this started?

Thanks
 
Chech Access VB Help on the DCount() function.

HTH
Van T. Dinh
MVP (Access)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top