Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Ajax thanks for the message,

    I actually resolve the first code, that uploads excel worksheet into access database and it works.
    below is the code.

    Code:
    'upload excel worksheet into access database
    Dim fname As String
    ActiveWorkbook.Save
    fname = myPath + "Dumader.xlsm"
    
    
    
    
    
    
    Set cn = CreateObject("ADODB.Connection")
      dbPath = Application.ActiveWorkbook.Path & "\CPdad.accdb"
      dbWb = Application.ActiveWorkbook.FullName
      dbWs = Application.ActiveSheet.Name
      scn = "provider='Microsoft.ACE.OLEDB.12.0';" & _
                "Data Source = " + dbPath
      dsh = "[" & Application.ActiveSheet.Name & "$]"
      cn.Open scn
      cn.Execute "INSERT INTO tbload SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=" & ActiveWorkbook.FullName & "]" & ".[Sheet1$A1:L4]"
    
    
      Set cn = Nothing
    I also actually solved the second code that export the database table into excel worksheet too, and it works, this code below.
    Code:
    Set cnn = New ADODB.Connection
        Set rs = New ADODB.Recordset
          
        strFilePath = Application.ActiveWorkbook.Path & "\Coad.accdb"
      
        cnn.Open "provider='Microsoft.ACE.OLEDB.12.0';" & _
                "Data Source = " + strFilePath
        sQRY = "SELECT * FROM tblCupload"
      
        rs.CursorLocation = adUseClient
        rs.Open sQRY, cnn, adOpenStatic, adLockReadOnly
        Application.ScreenUpdating = False
        Sheet1.Range("A2").CopyFromRecordset rs
        
        cnn.Close




    all i need now is to create a python file and export the access database table into a newly created excel worksheet and save it in the directory.

  2. #17
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    surprised that works - excel 8 is .xls, not .xlsm, but if it works, it works

    good luck with your project - I cannot help with python

  3. #18
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Ok, thanks !

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Not an Access Question
    By MaineLady in forum Access
    Replies: 0
    Last Post: 03-14-2015, 01:50 PM
  2. Replies: 4
    Last Post: 12-14-2013, 06:20 PM
  3. RunApp to Open a python file
    By raytackettsells in forum Programming
    Replies: 1
    Last Post: 10-16-2013, 12:26 PM
  4. Converting Access Backend from Access 2003 to SQL Question
    By seattlebrew in forum Database Design
    Replies: 0
    Last Post: 03-07-2013, 07:14 PM
  5. Access Question!
    By gn987654 in forum Access
    Replies: 1
    Last Post: 12-10-2008, 03:30 PM

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