okay, so i am designing a login system which is connected to a preset database i made in ms access. here's the code that i have written:
there is a run time error which says that it could not find the file of my database. when debug, the line:
Set db = DBEngine.OpenDa tabase(DbFile, False, False)
seems to be the problem. what should i do?
Code:
Private Sub cmd_ok_Click()
'Declare variables
Dim db As DAO.Database
'= DBEngine.OpenDatabase(DbFile, False, False)
Dim rs As Recordset
Dim WS As Workspace
'Set workspace,database and recordset
Set WS = DBEngine.Workspaces(0)
DbFile = App.Path & ("\sample database 2000.mdb")
Set db = DBEngine.OpenDatabase(DbFile, False, False)
Set rs = db.OpenRecordset("Login", dbOpenTable)
'To compare data in textboxes with that in database
If txt_password.Text = rs("Password") And txt_IDnum = rs("ID Number") Then
'Show main menu form
frm_mainmenu.Show
Unload Me
Else
'Display message box
MsgBox "Wrong Username and/or Password!", vbCritical, "Warning"
End If
End Sub
there is a run time error which says that it could not find the file of my database. when debug, the line:
Set db = DBEngine.OpenDa tabase(DbFile, False, False)
seems to be the problem. what should i do?