Help Mr. ADMIN

Submitted by cidfrey on
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.
  1. Option Explicit
  2.  
  3. Public Enum InputType
  4.     Date_Slash_Input = 0
  5.     Date_Dash_Input = 1
  6.     Numeric_Input = 2
  7.     Text_Input = 3
  8.     Currency_Input = 4
  9. End Enum
  10.  
  11. Global windowMode As Boolean
  12.  
  13. Global dbReport As New ADODB.Connection
  14. Global rsreport As New ADODB.Recordset
  15.  
  16.  
  17. Public Sub OpenConn(ByVal db As ADODB.Connection, ByVal rs As ADODB.Recordset, strSQL As String)
  18.  
  19. db.CursorLocation = adUseClient
  20. db.Provider = "Microsoft.Jet.OLEDB.4.0"
  21. db.Open App.Path & "\data.mdb"
  22. rs.Open strSQL, db, adOpenDynamic, adLockOptimistic
  23. End Sub
  24.  
  25. Public Sub CloseConn(ByVal rs As ADODB.Recordset, db As ADODB.Connection)
  26.  
  27. rs.Close
  28. db.Close
  29.  
  30. End Sub
  31.  
  32. Public Sub ComboLoad(ByVal cbo As ComboBox, ByVal strSQL As String, ByVal fldval As String)
  33.  
  34. Dim dbTemp As New ADODB.Connection
  35. Dim rsTemp As New ADODB.Recordset
  36.  
  37. cbo.Clear
  38. OpenConn dbTemp, rsTemp, strSQL
  39. With rsTemp
  40.     While Not .EOF = True
  41.         cbo.AddItem .Fields(fldval)
  42.         .MoveNext
  43.     Wend
  44. End With
  45. CloseConn rsTemp, dbTemp
  46.  
  47. End Sub
  48.  
  49. Public Function ValidateInput(KeyAscii As Integer, Format As InputType, Optional Uppercase As Boolean) As Integer
  50.  
  51. If (Format = Date_Slash_Input) Then
  52.  
  53.     If (KeyAscii > 57 Or KeyAscii < 48) Then
  54.         If (KeyAscii <> 8) Then
  55.             If (KeyAscii <> 47) Then
  56.                 KeyAscii = 0
  57.             End If
  58.         End If
  59.     End If
  60.  
  61. ElseIf (Format = Date_Dash_Input) Then
  62.  
  63.     If (KeyAscii > 57 Or KeyAscii < 48) Then
  64.         If (KeyAscii <> 8) Then
  65.             If (KeyAscii <> 45) Then
  66.                 KeyAscii = 0
  67.             End If
  68.         End If
  69.     End If
  70.    
  71. ElseIf (Format = Numeric_Input) Then
  72.  
  73. If (KeyAscii < 48 Or KeyAscii > 57) Then
  74.     If (KeyAscii <> 8) Then
  75.         KeyAscii = 0
  76.     End If
  77. End If
  78.    
  79.    
  80. ElseIf (Format = Text_Input) Then
  81.  
  82. If (KeyAscii >= 65 And KeyAscii <= 122 Or (KeyAscii = 32 Or KeyAscii = 8)) Then
  83.     If (Uppercase = True) Then
  84.         KeyAscii = Asc(UCase(Chr(KeyAscii)))
  85.     End If
  86. Else
  87.     KeyAscii = 0
  88. End If
  89.  
  90.  
  91. ElseIf (Format = Currency_Input) Then
  92.  
  93.     If (KeyAscii > 57 Or KeyAscii < 48) Then
  94.         If (KeyAscii <> 8 And KeyAscii <> 36 And KeyAscii <> 44 And KeyAscii <> 46) Then
  95.             KeyAscii = 0
  96.         End If
  97.     End If
  98. End If
  99.  
  100. ValidateInput = KeyAscii
  101.  
  102. End Function