I too have a problem with Dlookup stopping working for no apparent reason.
I've been working on a DB for months. Finally got it working the way it
should and have been taking it back and forth on a pen drive from work to
home to work on it.
2 days ago, the switchboard function stopped working. The form loads
fine,
the user puts his password and user ID in and it's supposed to look up his
permissions.
On my work machine, it works just fine. Now on every other machine I try
it
on (including the one at home on which it was partially developed) the
DLookup function returns the "you canceled the previous operation" error
(Runtime error 2001).
I have looked at the references for all machines -they are all identical.
I've copied from one to another (machine) back and forth, compacted and
repaired, and pulled my hair out. The ONLY machine it works on is my
laptop
from work.
Help.
Here is the code:
'Determine the user information via lookup table for password and status
LoggedUserNUID = Me.ubUserNUID
UserPassword = DLookup("[Password1]", "tblAccessData", "UserNUID =
LoggedUserNUID")
UserStatus = DLookup("[UserStatus]", "tblAccessData", "[UserNUID] =
LoggedUserNUID")
FYI (setups):
"LoggedUserNUID" is a global variable defined the Module
UserStatus is a public variable defined in the current form
[UserStatus] is the text field in the "tblAccessData" security table
All fields are text.
Oh and this routine worked for weeks without fail. I have NOT changed the
code so I know for a fact it is correct and works.
Any thoughts on why this is happening and how to fix it? I need to
distribute this to my team and can't until this works on their machines.
(Which I tested on Friday and it doesn't). HELP!!!!!
Ricter said:
Private Sub VendorChqNum_AfterUpdate()
Dim DateToUse As Variant
If IsNull(Me.VendorChqDate) And Not IsNull(Me.VendorChqNum) Then
DateToUse = DLookup("[VendorChqDate]", "tblInvoices",
"[VendorChqNum]='"
& _
Me.VendorChqNum & "'")
Me.VendorChqDate = DateToUse
' DateToUse = ""
Else: Exit Sub
End If
If Me.NewRecord And IsNull(PONum) Then
PONum = Me.Parent!PONum
Else
End If
End Sub
Has been working for months. Any ideas why this code would "up and
quit"?
I haven't changed a thing for weeks.
Thanks.