Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nesting a Select Query in an IF Them Statement

Status
Not open for further replies.

CptTom

Programmer
Jul 16, 2001
117
US
How do I nest a long Select DistinctRow query inside an IF Then statement? If Null, MsgBox "Empty" Else, Print Report.

Larry
 
Set up the query to be a recordset in your module.

~~~~
Dim dbs as database
Dim rst as recordset

Set dbs = CurrentDB
set rst = dbs.openrecordset("YourQueryNameHere, dbopendynaset)

If (rst.BOF and rst.Eof) then
MsgBox "Empty"
Else
'whatever necessary for the report here
DoCmd.OpenReport "YourReportNameHere", acPreview
End If

Set rst = Nothing
Set dbs = Nothing


MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top