Display Message

  • Thread starter Thread starter asok
  • Start date Start date
A

asok

I want to display a message when the query returns
no records, how can I do this on a form?

when users open a form -> Records -> Query -> enter
criteria, if it doesn't return any records,
I would like it to display a message rathter
than leaving blank screen.

Thank you,
-Asok
 
Asok,
Using ADO and a stored query:
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
Set con = CurrentProject.Connection
Set rstADO = con.Execute(CommandText:="QSEL_XYZ",
options:=adCmdTable)
If rstADO.EOF = True Then
MsgBox prompt:="There aren't any records",
buttons:=vbInformation + vbOkOnly, Title:="Your app"
End If
Set rst = Nothing
Set con = Nothing

Geof.
 
Thanks Geof, I will try it.
-Asok
-----Original Message-----
Asok,
Using ADO and a stored query:
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
Set con = CurrentProject.Connection
Set rstADO = con.Execute(CommandText:="QSEL_XYZ",
options:=adCmdTable)
If rstADO.EOF = True Then
MsgBox prompt:="There aren't any records",
buttons:=vbInformation + vbOkOnly, Title:="Your app"
End If
Set rst = Nothing
Set con = Nothing

Geof.
.
 
Back
Top