Data Checking VBA

So I’m using a part of a login code i got from youtube as a data checking system. The user will do an input, then click the button that will fire up this code. However, every time I try to, it shows an error saying “method or data member is not found” and then highlights the “Private Sub” line.

The expected flow is that input is checked if it can do A, B or C (and so on)

I haven’t used VBA before, so I dont know whats wrong.

Private Sub login_Click() If IsNull(Me.ID) Then MsgBox "Please Enter Student ID to Login", vbInformation, "Student ID Required" Me.ID.SetFocus Else 'Processing if key If IsNull(Me.ID.TextLength = 3) Then If (IsNull(DLookup("Room_id", "Key", "user_id='" & Me.ID.Value & "'"))) Then MsgBox "Unknown Key ID", vbInformation, "Unknown Key ID" Refresh Else DoCmd.OpenForm "Key Return" End If 'Processing if student ElseIf IsNull(Me.ID.TextLength = 10) Then If (IsNull(DLookup("user_id", "User", "user_id='" & Me.ID.Value & "'"))) Then MsgBox "Unregistered Student ID", vbInformation, "Unregistered Student ID" Refresh Else DoCmd.OpenForm "Session_Register" End If 'Processing if NRIC user ElseIf IsNull(Me.ID.TextLength = 12) Then If (IsNull(DLookup("user_id", "User", "user_id='" & Me.ID.Value & "'"))) Then MsgBox "New user detected. Request help from staff to continue.", vbInformation, "Unregistered User ID" DoCmd.OpenForm "New User" WindowMode = acDialog Else DoCmd.OpenForm "Session_Register" End If 'Processing if invalid number Else MsgBox "Invalid Input", vbInformation, "Invalid Input" Refresh End If End If End Sub 

submitted by /u/dat_Boi_Ge0rGyy
[link] [comments]

Posted on