Hi,
I've written some code to correspond to a button_onclick event. The code is suppose to open another Access database and then use the DLookup function to validate a user's login name and password. However, I'm not sure how to reference the table in the other database. What is the correct syntax?
Here's a sample of my code
Dim wksp As Workspace
Dim db As Database
Dim tdf As TableDef
Set wksp = DBEngine.Workspaces(0)
Set db = wksp.OpenDatabase("s:\felix\LOA_DB_be.mdb"
Dim varLogin As Variant, varPassword As Variant
varLogin = DLookup("[LoginName]", "tblLogin", "[LoginName]='" & Me.txtLoginName & "'"
varPassword = DLookup("[Password]", "tblLogin", "[Password]='" & Me.txtPassword & "'"
When I run this event, Access gives me an error message saying that it can't find the input table or query named "tblLogin" in my DLookup statement.
Any suggestions?
Thanks.
I've written some code to correspond to a button_onclick event. The code is suppose to open another Access database and then use the DLookup function to validate a user's login name and password. However, I'm not sure how to reference the table in the other database. What is the correct syntax?
Here's a sample of my code
Dim wksp As Workspace
Dim db As Database
Dim tdf As TableDef
Set wksp = DBEngine.Workspaces(0)
Set db = wksp.OpenDatabase("s:\felix\LOA_DB_be.mdb"
Dim varLogin As Variant, varPassword As Variant
varLogin = DLookup("[LoginName]", "tblLogin", "[LoginName]='" & Me.txtLoginName & "'"
varPassword = DLookup("[Password]", "tblLogin", "[Password]='" & Me.txtPassword & "'"
When I run this event, Access gives me an error message saying that it can't find the input table or query named "tblLogin" in my DLookup statement.
Any suggestions?
Thanks.