If Statement

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I need code to accomplish the following:

1. Run "Alpha" query
2. If "Alpha" query has any results, open "Beta" form,
otherwise show message box stating "No results".

Any help will be greatly appreciated. Thanks.
 
If "Alpha" query is the RecordSource for "Beta" form, you can put the
following code in the OnOpen event of "Beta" form:

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There are no results to review."
Cancel = True
End If
 
-----Original Message-----
I need code to accomplish the following:

1. Run "Alpha" query
2. If "Alpha" query has any results, open "Beta" form,
otherwise show message box stating "No results".

Any help will be greatly appreciated. Thanks.
.
easy way is make alpha query recordsource for beta form
can use varying criteria if you want to use beta for other
queries
docmd.hourglass true
docmd.openform "Beta", , , , , acHidden
if conditions then
me.recordsource=alpha
end if
if Me.RecordsetClone.RecordCount = 0 then
msgbox " No Records Found",vbexclamation,"No results"
docmd.close acform,"Beta"
else
me.visible=true
docmd.hourglass false
end if
 
Back
Top