我一直在为我的访问数据库登录系统,登录系统工作正常但是当我尝试创建一个ACCDE它不会让我这样基于错误我检查代码和vba给了我这个错误(编译错误:找不到方法或数据成员)我编译它时,感谢帮助。代码如下。访问说这行是错误:(星星是发现错误的部分)[。txtLoginID]
If IsNull(Me.txtLoginID) Then
Option Compare Database
Private Sub Command1_Click()
Dim UserLevel As Integer
Dim TempPass As String
Dim ID As Integer
If IsNull(Me.txtLoginID) Then
MsgBox "Please Enter LoginID", vbInformation, "LoginID Required"
Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtpassword) Then
MsgBox "Please Enter Password", vbInformation, "Password Required"
Me.txtpassword.SetFocus
Else
'process the job
If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin='" & Me.txtLoginID.Value & "'"))) Or _
(IsNull(DLookup("Password", "tblUser", "Password='" & Me.txtpassword.Value & "'"))) Then
MsgBox "Incorrect LoginID or Password"
Else
UserLevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
TempPass = DLookup("password", "tblUser", "password = '" & Me.txtpassword.Value & "'")
ID = DLookup("UserID", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
DoCmd.Close
If (TempPass = "password") Then
MsgBox "Please Change Your Password", vbInformation, "New Password Required"
DoCmd.OpenForm "tblUser", , , "[UserID] = " & ID
Else
If UserLevel = 1 Then
'MsgBox "Login Sucussfull"
DoCmd.OpenForm "Admin Navigation Form"
Else
If UserLevel = 2 Then
'MsgBox "Login Sucussfull"
DoCmd.OpenForm "Area Director Navigation Form"
If UserLevel = 2 Then
DoCmd.LockNavigationPane -1
Else
DoCmd.OpenForm "Area Director Navigation Form"
End If
End If
End If
End If
End If
End If
End Sub
答案 0 :(得分:0)
确定问题不在您的主要代码上
当您尝试编译任何访问应用程序并创建MDE / ACCDE应用程序时,您必须验证您的库和引用
检查您的VBA面板:TOOLS>>参考
并验证您拥有所有并且没有任何行:[ERROR]或[NOT FOUND]
其他可能性是您正在使用DAO和ADO代码并且尚未引用首选库。样本:
有错误:dim db as database
正确:dim db as dao.database
如果您有一些库问题或错误引用,则无法完成编译过程并在代码的任何部分返回错误。