Form coding problem

Keiath

Registered User.
Local time
Today, 06:06
Joined
Jan 6, 2012
Messages
104
Trying to create a simple login but having problems with it running (high lighted in red) anyone any ideas i have crecked i have all the right names ect but cant see the problem

Please help


Option Compare Database

Private Sub cmdCancel_Click()
If MsgBox("Are you sure you want to cancel?" & vbCrLf & _
"If you cancel the database will close", vbQuestion + vbYesNo, "Cancel Confirmation") = vbYes Then
DoCmd.Quit
End If

End Sub

Private Sub cmdOK_Click()
Dim strUser As String
Dim strPWD As String
Dim intUSL As Integer

strUser = Me.txtUser
If DCount("[UserPWD]", "tblUsers", "[UserName]='" & Me.txtUser & "'") > 0 Then
strPWD = DLookup("[UserPWD]", "tblUsers", "[UserName]='" & Me.txtUser & "'")
If strPWD = Me.txtPWD Then
intUSL = DLookup("[SecurityGroup]", "tblUsers", "[UserName]='" & Me.txtUser & "'")
Forms!frmUSL.txtUN = strUser
Forms!frmUSL.txtUSL = intUSL
Select Case intUSL
Case 1
DoCmd.OpenForm "2014 Accounts Tracker Main Data", acNormal
Case 2
DoCmd.OpenForm "frmTestData", acNormal, , , acFormReadOnly
Case 3
MsgBox "Not configured yet", vbExclamation, "Not configured"
Case 4
MsgBox "Not configured yet", vbExclamation, "Not configured"
End Select
DoCmd.Close acForm, "frmTestLogin", acSaveNo
End If
End If



End Sub


Private Sub Cancel_Click()

End Sub

Private Sub Login_Click()

End Sub
 
What happens if you put
Code:
? DCount("[UserPWD]", "tblUsers", "[UserName]='" & "sampleusername" & "'")
into the VBA Immediate window? Any user will do, just make sure that line is working by itself.
 
And the error message is... ???????????
 
First attempt:
Press the button that remove all break points from your code - looks like the last part of your hand/arm (the part with fingers) with a brown diagonal line.

Second attempt: :)
Sanitize the DB, convert (if possible) in 2003 version and upload it.
 

Users who are viewing this thread

Back
Top Bottom