Variable not defined in a recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, Can anyone tell me why tblusers is being seen as a variable here? It
keeps saying "variable not defined".

Thank you very much (I'm still pretty much a newbie)

If rs.Fields("Floor").Value = "" And tblUsers.LoginID =
Form_frmComputers.Computer_Name Then
MsgBox "Please enter a Floor Value"
txtRoom.Enabled = True
End If
 
Joanne said:
Hello, Can anyone tell me why tblusers is being seen as a variable here? It
keeps saying "variable not defined".

Thank you very much (I'm still pretty much a newbie)

If rs.Fields("Floor").Value = "" And tblUsers.LoginID =
Form_frmComputers.Computer_Name Then
MsgBox "Please enter a Floor Value"
txtRoom.Enabled = True
End If


Table and field names are only known in queries. If you
open a recordset, the recordset object will make the fields
in its table/query available through its Fields collection.

I don't understand what you are trying to do here, but you
may be able to use the DLookup function to get the value
from the table. Possibly as simple as
. . . And DLookup("LoginID", "tblUsers") = _
Me.Computer_Name Then
or, if frmComputers is a different form,
. . . And DLookup("LoginID", "tblUsers") = _
Forms!frmComputers.Computer_Name Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top