Running a query and using the results in Visual Basic

  • Thread starter Phillip Topping
  • Start date
P

Phillip Topping

How can I run a command in a VB macro and actually use the results to
determine what an If...Then statement is going to do for me?

I know I can run it with DoCmd etc.........but how do I tell my macro to use
the results?

For example.......if I run a query that tells me how many data entries were
made for today....

If my query returns no results.......ie: no data entered.......I would query
B to run next.......but if I do have data for today......I want to run Query
C.

My problem is.......how do I use the query results?


Any suggestions would be greatly appreciated.
TIA

Phillip
 
T

Tom Cooper and Chris Sergent

Create a DCount function in your condition on the macro.
If the value equals zero, have it display a message box
otherwise run the query and then the rest of the queries
in the macro should follow this logic.
 

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

Top