Macro If Condition. Help me Guys

jabes7

New member
Local time
Tomorrow, 03:28
Joined
Mar 21, 2012
Messages
3
I want to run a Query-B based on condition of another Query-A in Macros or VBA Code.

Query-A Select name from employee where inserted_date= date() //today's date

Query-B -- bla bla

My Need is if Query-A returns any values, Query B need to be executed..
I Tried with IF CONDITION in macros but its saying table name not found.:banghead:

Suggest me PROPER RUNNING IF CONDITION in Macros or Hard Coding in VBA.

Thanks in Advance:)
 
You would need DCount to test.

In VBA, it would be like this:

Code:
If DCount("*", "Query-A") > 0 Then
   DoCmd.OpenQuery "Query-B"
End If

So, not sure which version of Access you are on but the macro for 2007 and below would be something like

in the Condition area:
DCount("*", "Query-A") > 0

Action is OPEN QUERY
 
Thanks a lot Bob. It Worked. :):)

Would be grate if any hyperlink or path suggested for learning basic to Expert level VBA Programming!:)
 

Users who are viewing this thread

Back
Top Bottom