下面是一些授权用户登录 MS Access 数据库的 VBA 代码。我正在尝试修复此代码,但我不明白此代码段中有什么问题。
Private Sub cmdLogin_Click()
Dim lngUserID As Long
lngUserID = Nz(DLookup("UserID", _
"tblUser", "username = '" _
& Me!cbousername _
& "' AND Password = '" _
& Me!txtPassword & "'"), 0)
If lngUserID = 0 Then
MsgBox "Username and/or password are incorrect."
Me!txtPassword.SetFocus
Else
MsgBox "Registration successful!"
OptionSetting "CurrentUserID", CStr(lngUserID)
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Homepage"
End If
SetWebControlAsIE9
ChangeWebControlFeature
END SUB
VBE 中的调试器显示以下以黄色突出显示的代码。有人可以帮助我了解问题所在吗?
lngUserID = Nz(DLookup("UserID", _
"tblUser", "username = '" _
& Me!cbousername _
& "' AND Password = '" _
& Me!txtPassword & "'"), 0)