Test for query results

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

Hi everybody:

I do not know how to test for results in a query.

I have qryExpiry that tests to see if an expiry date has been reached. I
would like this query to run at the startup of my database. If there are
records, I need a message box to pop up and then clicking on an OK button in
the message box would open the rptExpiry but if there are no records in the
query recordset then I just want things to continue as normal.

How do I go about accomplishing this?

Thanks a bunch!
 
CJ said:
Hi everybody:

I do not know how to test for results in a query.

I have qryExpiry that tests to see if an expiry date has been reached. I
would like this query to run at the startup of my database. If there are
records, I need a message box to pop up and then clicking on an OK button in
the message box would open the rptExpiry but if there are no records in the
query recordset then I just want things to continue as normal.

How do I go about accomplishing this?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Create an AutoExec macro that runs a function like the following:

Public Function IsExpired()

If DCount("*","qryExpiry") > 0 Then
MsgBox "Expiry Records",vbInformation
DoCmd.OpenReport "rptExpiry"
End If

End Function
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnKeaYechKqOuFEgEQLUbgCg2D0SzanPEnDY+Af3ropNM+GmVw0AnA5G
/lV8q391NYRnaIes2bfzSpj6
=E045
-----END PGP SIGNATURE-----
 
Brilliant, got it, thanks very much.

One more related question.

I would like this report to keep the focus and stay in front, but the
message box comes up, you click OK and the switchboard pops in front.

I have tried using the SelectObject function, and also setting the report to
modal (which I do not like).
Any thoughts?

Thanks for your help.
C
 
Never mind. There is some extra code that is putting the focus back on the
switchboard.

Thanks again.
 
Back
Top