ranjith2523
Board Regular
- Joined
- Apr 29, 2014
- Messages
- 137
- Office Version
- 365
Hi Friends,
I have an Excel with Sheet named "Report" where I have Data from Columns A to G like below.
I wrote the below code to insert the data from Excel To Access but i am not sure how to write the code to insert or Apend it from Excel Sheet To Access
If i hard code like this "Query = "INSERT INTO Report VALUES (1,2,3,4,5,6,7)" it perfectly inserted on my Access but i need to insert the data from Excel sheet (Sheet Name "Report") from Column A to G.
Can someone please help me on this.
I have an Excel with Sheet named "Report" where I have Data from Columns A to G like below.
ID664 | NPI | Management | Lete | Open | NPI | ASIAPACIFIC |
ID898 | ATPM | Management | NKI | Open | SRPM | EMEA |
I wrote the below code to insert the data from Excel To Access but i am not sure how to write the code to insert or Apend it from Excel Sheet To Access
If i hard code like this "Query = "INSERT INTO Report VALUES (1,2,3,4,5,6,7)" it perfectly inserted on my Access but i need to insert the data from Excel sheet (Sheet Name "Report") from Column A to G.
Can someone please help me on this.
VBA Code:
StrProvider = "Microsoft.ACE.OLEDB.12.0;"
StrConnection = "Provider=" & StrProvider & "Data Source=" & StrPath
StrDBConn.Open StrConnection
Query = "INSERT INTO Report VALUES (1,2,3,4,5,6,7)"
StrDBConn.Execute Query