I have this typical data.mdb file with a password (moviemaker). Now I want to access the tblUser through my login window. Now I encounter an error "Not a valid password". I know I didn't put the password of the data.mdb on the module of my program.
I tried to manipulate it through your tutorial on the FAQ but it didn't work specially on the "DBPath" thing. Here is my code from my module. I don't know where to put the password.
On this line --->> db.Open App.Path & "\data.mdb" is where the highlighted error occurs. I really don't know where to put the "Data Source="& DBPath &":Persist Security Info=False";Jet OLEDB:Database Password=moviemaker"
Please help me about my problem.
- Option Explicit
- Public Enum InputType
- Date_Slash_Input = 0
- Date_Dash_Input = 1
- Numeric_Input = 2
- Text_Input = 3
- Currency_Input = 4
- End Enum
- Global windowMode As Boolean
- Global dbReport As New ADODB.Connection
- Global rsreport As New ADODB.Recordset
- Public Sub OpenConn(ByVal db As ADODB.Connection, ByVal rs As ADODB.Recordset, strSQL As String)
- db.CursorLocation = adUseClient
- db.Provider = "Microsoft.Jet.OLEDB.4.0"
- db.Open App.Path & "\data.mdb"
- rs.Open strSQL, db, adOpenDynamic, adLockOptimistic
- End Sub
- Public Sub CloseConn(ByVal rs As ADODB.Recordset, db As ADODB.Connection)
- rs.Close
- db.Close
- End Sub
- Public Sub ComboLoad(ByVal cbo As ComboBox, ByVal strSQL As String, ByVal fldval As String)
- Dim dbTemp As New ADODB.Connection
- Dim rsTemp As New ADODB.Recordset
- cbo.Clear
- OpenConn dbTemp, rsTemp, strSQL
- With rsTemp
- While Not .EOF = True
- cbo.AddItem .Fields(fldval)
- .MoveNext
- Wend
- End With
- CloseConn rsTemp, dbTemp
- End Sub
- Public Function ValidateInput(KeyAscii As Integer, Format As InputType, Optional Uppercase As Boolean) As Integer
- If (Format = Date_Slash_Input) Then
- If (KeyAscii > 57 Or KeyAscii < 48) Then
- If (KeyAscii <> 8) Then
- If (KeyAscii <> 47) Then
- KeyAscii = 0
- End If
- End If
- End If
- ElseIf (Format = Date_Dash_Input) Then
- If (KeyAscii > 57 Or KeyAscii < 48) Then
- If (KeyAscii <> 8) Then
- If (KeyAscii <> 45) Then
- KeyAscii = 0
- End If
- End If
- End If
- ElseIf (Format = Numeric_Input) Then
- If (KeyAscii < 48 Or KeyAscii > 57) Then
- If (KeyAscii <> 8) Then
- KeyAscii = 0
- End If
- End If
- ElseIf (Format = Text_Input) Then
- If (KeyAscii >= 65 And KeyAscii <= 122 Or (KeyAscii = 32 Or KeyAscii = 8)) Then
- If (Uppercase = True) Then
- KeyAscii = Asc(UCase(Chr(KeyAscii)))
- End If
- Else
- KeyAscii = 0
- End If
- ElseIf (Format = Currency_Input) Then
- If (KeyAscii > 57 Or KeyAscii < 48) Then
- If (KeyAscii <> 8 And KeyAscii <> 36 And KeyAscii <> 44 And KeyAscii <> 46) Then
- KeyAscii = 0
- End If
- End If
- End If
- ValidateInput = KeyAscii
- End Function
- Add new comment
- 34 views