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
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"
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"
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