How to fix '-2147467259 (80004005)': [Microsoft] [ODBC Microsoft Access driver] not a valid password.

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Adding records to Database getting following error...
Getting error message exact as below
Code:
[FONT=Courier New]'-2147467259 (80004005)': [Microsoft] [/FONT]
[FONT=Courier New][ODBC Microsoft Access driver] not a valid password [/FONT]

Actual Code: error on BLUE line below.


I would really appriciate any help. Just stucked just dont know how to proceed...just same error already asked by someone too but doesnt solve me problem.


Rich (BB code):
Sub CallAddTransfer()
  ' Used to call the code from page 480
  Dim WS As Worksheet
  Dim Qty As Integer
  Set WS = Worksheets("AddRecords")
  FinalRow = WS.Cells(Rows.Count, 1).End(xlUp).Row
  Ctr = 0
  For i = 7 To FinalRow
      Style = Cells(i, 1).Value
      FromStore = Cells(i, 2).Value
      ToStore = Cells(i, 3).Value
      Qty = Cells(i, 4).Value
      Ctr = Ctr + 1
      Application.StatusBar = "Adding Record " & Ctr
      AddTransfer Style, FromStore, ToStore, Qty
  Next i
  Application.StatusBar = False
  MsgBox Ctr & " records added."
End Sub
Sub AddTransfer(Style As Variant, FromStore As Variant, ToStore As Variant, Qty As Integer)
  ' Page 480
  Dim cnn As ADODB.Connection
  Dim rst As ADODB.Recordset
  Dim pwd As String
 
  MyConn = ThisWorkbook.Path & Application.PathSeparator & "Transfers.mdb"
  MyConn = "Driver=Microsoft Access Driver (*.mdb);DBQ=" & MyConn
  pwd = "mypass"
 
 
  ' open the connection
  Set cnn = New ADODB.Connection
  With cnn
      '.Provider = "Microsoft.Jet.OLEDB.4.0"
      .Open MyConn, mypass
  End With
 
  ' Define the Recordset
  Set rst = New ADODB.Recordset
  rst.CursorLocation = adUseServer
 
  ' open the table
  rst.Open Source:="tblTransfer", _
  ActiveConnection:=cnn, _
  CursorType:=adOpenDynamic, _
  LockType:=adLockOptimistic, _
  Options:=adCmdTable
 
  ' Add a record
  rst.AddNew
 
  ' Set up the values for the fields. The first four fields
  ' are passed from the calling userform. The date field
  ' is filled with the current date.
  rst("Style") = Style
  rst("FromStore") = FromStore
  rst("ToStore") = ToStore
  rst("Qty") = Qty
  rst("tDate") = Date
  rst("Sent") = False
  rst("Receive") = False
 
  ' Write the values to this record
  rst.Update
 
  ' Close
  rst.Close
  cnn.Close
End Sub
The code is from Bill's Latest book i guess :).


Thanks again
 
Last edited:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Bump. Please tell/help me any way round to solve this out. Any other examples will be great!

Thanks again!
 
Upvote 0
I read somewhere (and I could very well be wrong) but I remember something about not being able to pass the password. I'll see if I can dig up the reference and get back to you. (or hopefully someone who has a real answer will chime in)
 
Upvote 0
Thanks alot. Probable i am not giving password conditions/line in the right place.
I'll appriciate any help.:)
 
Upvote 0
What password do you use to open the database (i.e. normally, without vba or any code)?
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top