BoxerBrats
Programmer
ok new to all this but when I goto run my program I keep getting a runtime error '3001'
below is my code
Private Sub Form_Load()
'**** Connect to database
Dim strConnection As String
Dim path As String
path = App.path & "\Database.mdb"
'**** Set path for location of database
strConnection = "driver={Microsoft Access Driver (*.mdb)};dbq=" & App.path & "\Data\Database.mdb" & ";uidpwd"
Set conDB = New ADODB.Connection
conDB.Open strConnection
'**** Set all new recordsets
Set rstEquipment = New ADODB.Recordset
Set rstVehicleData = New ADODB.Recordset
Set rstVehicleMiles = New ADODB.Recordset
Set rstWorkOrder = New ADODB.Recordset
Set rstParts = New ADODB.Recordset
Set rstPartsHistory = New ADODB.Recordset
Set rstPO = New ADODB.Recordset
Set rstVendors = New ADODB.Recordset
Set rstLabor = New ADODB.Recordset
Set rstOfficeEquipment = New ADODB.Recordset
Set rstBuildingEquipment = New ADODB.Recordset
Set rstUser = New ADODB.Recordset
End Sub
Private Sub cmdEnter_Click()
'**** stop blank entry
If txtUserName = "" Then
Prompt$ = "You have to enter your login name"
reply = MsgBox(Prompt$, 48, "Blank Login Name"
txtUserName.SetFocus
'**** SET BACK DOOR
ElseIf txtUserName.Text = "6783" Then
User = "BackDoor"
Password = 496
UserLevel = "Admin"
AccessLevel = 1
Timer1.Enabled = True
Else
'**** set user name
User = txtUserName.Text
'Check whether user exist in the database
rstUser.Open "SELECT * FROM User WHERE User.LoginName ='" & User & "'", conDB, adOpenStatic, adLockReadOnly"
If Not rstUser.EOF Then
'Check whether password is correct
If (Password = rstUser!UserPassword) Then
'Assign user level to global variable
UserLevel = rstUser!UserLevel
AccessLevel = 1
Timer1.Enabled = True
Else
MsgBox "Logged on failed - Invalid Password", vbCritical, "Login"
End If
Else
MsgBox "Logged on failed - Invalid User", vbCritical, "Login"
End If
End If
End Sub
any help would be great thanks
below is my code
Private Sub Form_Load()
'**** Connect to database
Dim strConnection As String
Dim path As String
path = App.path & "\Database.mdb"
'**** Set path for location of database
strConnection = "driver={Microsoft Access Driver (*.mdb)};dbq=" & App.path & "\Data\Database.mdb" & ";uidpwd"
Set conDB = New ADODB.Connection
conDB.Open strConnection
'**** Set all new recordsets
Set rstEquipment = New ADODB.Recordset
Set rstVehicleData = New ADODB.Recordset
Set rstVehicleMiles = New ADODB.Recordset
Set rstWorkOrder = New ADODB.Recordset
Set rstParts = New ADODB.Recordset
Set rstPartsHistory = New ADODB.Recordset
Set rstPO = New ADODB.Recordset
Set rstVendors = New ADODB.Recordset
Set rstLabor = New ADODB.Recordset
Set rstOfficeEquipment = New ADODB.Recordset
Set rstBuildingEquipment = New ADODB.Recordset
Set rstUser = New ADODB.Recordset
End Sub
Private Sub cmdEnter_Click()
'**** stop blank entry
If txtUserName = "" Then
Prompt$ = "You have to enter your login name"
reply = MsgBox(Prompt$, 48, "Blank Login Name"
txtUserName.SetFocus
'**** SET BACK DOOR
ElseIf txtUserName.Text = "6783" Then
User = "BackDoor"
Password = 496
UserLevel = "Admin"
AccessLevel = 1
Timer1.Enabled = True
Else
'**** set user name
User = txtUserName.Text
'Check whether user exist in the database
rstUser.Open "SELECT * FROM User WHERE User.LoginName ='" & User & "'", conDB, adOpenStatic, adLockReadOnly"
If Not rstUser.EOF Then
'Check whether password is correct
If (Password = rstUser!UserPassword) Then
'Assign user level to global variable
UserLevel = rstUser!UserLevel
AccessLevel = 1
Timer1.Enabled = True
Else
MsgBox "Logged on failed - Invalid Password", vbCritical, "Login"
End If
Else
MsgBox "Logged on failed - Invalid User", vbCritical, "Login"
End If
End If
End Sub
any help would be great thanks