linking an excel spreadsheet to an access table using vb 
Author Message
 linking an excel spreadsheet to an access table using vb

Hi all,

I am converting a project  written in VBA to VB.  I have come accross a bit
of a stumbling block.

I need to link an excel spreadsheet to an access table from within VB.  Any
suggestions as to how I could go about doing it??

The code in VBA is as follows:

Private Sub Import_Data_Click()
On Error GoTo Err_Import_Data_Click

    DoCmd.SetWarnings False
    Me.Refresh
    DoCmd.RunSQL "Drop Table [Financial Data Input Sheet];"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "Financial
Data Input Sheet", Me![Directory Location] & "\" & Me![Input Filename], True
    DoCmd.SetWarnings True

    Call Create_Model
    MsgBox ("Model Data has been successfully imported.")

Exit_Import_Data_Click:
    Exit Sub

Err_Import_Data_Click:
    If Err.Number = 3376 Then
        Resume Next
    Else
        DoCmd.SetWarnings True
        MsgBox Err.Number & " - " & Err.Description
        Resume Exit_Import_Data_Click
    End If

End Sub



Sat, 28 Sep 2002 03:00:00 GMT  
 linking an excel spreadsheet to an access table using vb

Quote:

> I need to link an excel spreadsheet to an access table from within VB.  Any
> suggestions as to how I could go about doing it??

Have a look at

http://www.microsoft.com/data/ado/adotechinfo/dao2ado_4.htm

Tells you how to create linked tables in both DAO and ADO, though whether it'll work with an Excel spreadsheet I'm afraid I've no idea - though it looks as though it should....

Roger Morton



Sat, 28 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. linking a excel spreadsheet to an access table through vb

2. linking an excel spreadsheet to an access database using vb

3. Importing Excel Spreadsheet into an Access 2000 Table using VB

4. Export tables to Excel Spreadsheet using VB

5. Access table to Excel Spreadsheet in VB 6

6. Excel spreadsheet from an Access database using VB?

7. Prompts to update links when opening Excel spreadsheet from Access

8. Access Linking to Excel Spreadsheets

9. How to link a passwd protected Excel spreadsheet to Access in VB6

10. How to link a password protected Excel 97 Spreadsheet to Access 97

11. linking an excel spreadsheet to an access database from vb6

12. Accessing Linked Oracle Tables in Access Using ODBC in VB

 

 
Powered by phpBB® Forum Software