User Login

ciapul12

New member
Local time
Today, 09:33
Joined
Jul 30, 2014
Messages
5
Hi There,
I've been using the same code since 2014 for user login form but this no longer works and I have no idea why.
Either the code refers to non existing field or newer version of access no longer supports the function?
Code:
Private Sub Form_Load()
Me.User = gUserName
Me.FullName = DLookup("UserName", "tblUser", "[UserLogin] ='" & Me.User & "'")
Me.greeting = "Welcome back " & gUserName
End Sub

Screenshot 2024-08-15 1224291.png

Would appreciate anyone's help.

Thanks
Dan
 
Why not show the line that the error is on? :(
 

Attachments

  • Screenshot 2024-08-15 123756.png
    Screenshot 2024-08-15 123756.png
    10.8 KB · Views: 56
  • Screenshot 2024-08-15 12372623.png
    Screenshot 2024-08-15 12372623.png
    21.4 KB · Views: 64
Make sure the form has the following controls: user, fullname, and greeting.
 
set "option explicit" to ensure variables are defined... no effect in the current procedure but good practice.
 
That error message could ALSO be the result of a damaged or broken reference (from the VBA >> Tools >> References list). Try to open your VBA editing page to check your References list. An update could have clobbered one of the library links, making it impossible for the code to run. If so, the fix is simply to remove the broken link and update with a new link to the same (or possibly patched/updated) library.

The other alternative is to attempt a Compact & Repair, just in case this is the result of a corrupted database. When doing a C&R, you must ALWAYS make a backup copy of your file in case the attempted repairs goes bonkers.
 
I've disabled the code all together and it made no difference on he functionality of the system so I guess for now it's sorted
 
you're either missing a control named exactly like those are, or the gUsername function.
it's not a problem with the dlookup because a compile error caught it
 

Users who are viewing this thread

Back
Top Bottom