Results 1 to 5 of 5
  1. #1
    jjotc23 is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2013
    Posts
    3

    Unrecognized database format 'C:\xx.accdb'

    Hi There,
    I need a big help from you guys.
    I have been tried to get this Word Form (2013) into Access (2013) for two days. Like to let you know that I don't know any thing about vba codes at all. Thanks.

    Here is the vba code that I copy from MS website:
    Option Compare Database
    Sub GetWordData()
    Dim appWord As Word.Application
    Dim docx As Word.Document
    Dim cnn As New ADODB.Connection
    Dim rst As New ADODB.Recordset
    Dim strDocxName As String
    Dim blnQuitWord As Boolean
    On Error GoTo ErrorHandling
    strDocName = "C:\Contracts\" & _
    InputBox("Enter the name of the Word contract " & _
    "you want to import:", "Import Contract")
    Set appWord = GetObject(, "Word.Application")
    Set docx = appWord.Documents.Open(strDocxName)
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\CDAC\" & _
    "HealthcareContracts-new.accdb"
    rst.Open "tblContracts", cnn, _
    adOpenKeyset, adLockOptimistic
    With rst
    .AddNew
    !FirstName = docx.FormFields("fldFirstName").Result
    !LastName = docx.FormFields("fldLastName").Result
    !Company = docx.FormFields("fldCompany").Result
    !Address = docx.FormFields("fldAddress").Result
    !City = docx.FormFields("fldCity").Result
    !State = docx.FormFields("fldState").Result
    !ZIP = docx.FormFields("fldZIP1").Result
    !Phone = docx.FormFields("fldPhone").Result
    !SocialSecurity = docx.FormFields("fldSocialSecurity").Result
    !Gender = docx.FormFields("fldGender").Result
    !BirthDate = docx.FormFields("fldBirthDate").Result
    !AdditionalCoverage = _
    docx.FormFields("fldAdditional").Result
    .Update
    .Close
    End With
    docx.Close
    If blnQuitWord Then appWord.Quit
    cnn.Close
    MsgBox "Contract Imported!"
    Cleanup:
    Set rst = Nothing
    Set cnn = Nothing
    Set docx = Nothing
    Set appWord = Nothing
    Exit Sub
    ErrorHandling:
    Select Case Err
    Case -2147022986, 429
    Set appWord = CreateObject("Word.Application")
    blnQuitWord = True
    Resume Next
    Case 5121, 5174
    MsgBox "You must select a valid Word document. " _
    & "No data imported.", vbOKOnly, _
    "Document Not Found"
    Case 5941
    MsgBox "The document you selected does not " _
    & "contain the required form fields. " _
    & "No data imported.", vbOKOnly, _
    "Fields Not Found"
    Case Else
    MsgBox Err & ": " & Err.Description


    End Select
    GoTo Cleanup
    End Sub

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CDAC\HealthcareContracts-new.accdb"

    This is the file you're trying to open.

    Where did you get this code and what version of access does it apply to?

    You may need to update the reference to jet.oledb.4.0

    Microsoft.ACE.OLEDB.12.0 (for example).


    I *think* 4.0 is up to access 2003 and you're on access 2013, someone can correct me if I'm wrong on that.

  3. #3
    jjotc23 is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2013
    Posts
    3
    Quote Originally Posted by rpeare View Post
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CDAC\HealthcareContracts-new.accdb"

    This is the file you're trying to open.

    Where did you get this code and what version of access does it apply to?

    You may need to update the reference to jet.oledb.4.0

    Microsoft.ACE.OLEDB.12.0 (for example).


    I *think* 4.0 is up to access 2003 and you're on access 2013, someone can correct me if I'm wrong on that.
    Thanks.
    Yes, it is.
    I got the code from "http://msdn.microsoft.com/en-us/libr...ffice.10).aspx" and I think it is for 2000. I did up date the jet.oledb.4.0 to ACE.OLEDB,12.0, then I got this error msg "91: Object variable or with block variable not set".
    Thank you so much for your help.

  4. #4
    AlexHedley's Avatar
    AlexHedley is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    England
    Posts
    180

    Unrecognized database format 'C:\xx.accdb'

    Quote Originally Posted by jjotc23 View Post
    jet.oledb.4.0 to ACE.OLEDB,12.0
    "91: Object variable or with block variable not set".
    Did you have a , between OLEDB and the version # as in the above quote or was that a typo?

    Can you post the code you have amended it to just for that connection line?

    Also Access 2013 is version 15 if I'm not mistaken.
    Check program files and Office to see which one you have.
    You would probably need to change it to that.

  5. #5
    jjotc23 is offline Novice
    Windows 8 Access 2013
    Join Date
    May 2013
    Posts
    3
    Hi Alex,
    I did change some of the codes to match with access 2013, also updated the JET to ACE. The MS Access 15.0 Object Library also selected under the references of the access.
    "cnn.Open "Provider=Microsoft.ACE.OLEDB.15.0;" & _
    "Data Source=C:\CDAC\" & _
    "HealthcareContracts-new.accdb"
    rst.Open "tblContracts", cnn, _
    adOpenKeyset, adLockOptimistic"
    Again thanks.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-04-2013, 02:32 PM
  2. Unrecognized database format
    By looloo in forum Access
    Replies: 4
    Last Post: 09-26-2011, 11:33 PM
  3. Database in unrecognized format - 2010 to 2007
    By ajetrumpet in forum Access
    Replies: 2
    Last Post: 03-16-2011, 01:46 PM
  4. Unrecognized database format
    By Frank in forum Access
    Replies: 1
    Last Post: 08-05-2009, 07:35 AM
  5. Unrecognized database format
    By pacala_ba in forum Access
    Replies: 0
    Last Post: 03-19-2009, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums