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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

no current records - query code definition.

Status
Not open for further replies.

rocco

IS-IT--Management
Oct 30, 2001
106
CA
hello :)

I am looking for a command that will tell me when the query returns no values. I thought if the variable was "" nothing then it would work but I am getting an error....

---------------------------------------------------
Run-time error '3021': No current record.
---------------------------------------------------


This is my code...

Dim db As Database, rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("SwitchForm_Check", dbOpenDynaset)

if rst.Fields("Title") = "lola" Then

Forms![SJHC - Communication].CommBtn99.Visible = True
Forms![SJHC - Communication].CommLabel99.Visible = True

'This would be the problem....I need code to let me know when the query gets nothing.

If rst.Fields("Title") = "" Then
Forms![SJHC - Communication].CommBtn99.Visible = False
Forms![SJHC - Communication].CommLabel99.Visible = False
End If
End If

rst.Close
db.Close


Any suggestions would be greatly appreciated.
Thank you

 
Thank you AutumnBlues
It is perfect........
Have a good day....:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top