Home > Software engineering >  Vb programming to realize copy excel data to access it
Vb programming to realize copy excel data to access it

Time:09-23

Help!!!!!
How to implement using vb2010 programming will excel in a work table data is copied to the access inside

CodePudding user response:

upupup

CodePudding user response:

1. Open the EXCEL file
programming2. Turn on the ACCESS database programming
3. The programming in the EXCEL table data is copied to the ACCESS
4. Programming to close open the EXCEL file and ACCESS

CodePudding user response:

This look for me, I have written: QQ 2776478814

CodePudding user response:

3/f said makes sense,

CodePudding user response:

Document formats are different, this cannot be called "copy".


Actually is also open the Excel document, from "read data" inside it, then "written" to Access the table records, field,
Add the Access to open the existing documents, can also create a new document, adding "a new table",
Then the modified or new Access document preservation,

Finally shut itself down to open the Excel document, Access documents,

CodePudding user response:

reference 5 floor Chen8013 reply:
document formats are different, this cannot be called "copy".


Actually is also open the Excel document, from "read data" inside it, then "written" to Access the table records, field,
Add the Access to open the existing documents, can also create a new document, adding "a new table",
Then the modified or new Access document preservation,

Finally shut itself down to open the Excel document, Access documents,


I now I write the code

 Dim db As New ADODB. Connection 
Dim sPath As String
Dim AccessPath As String
The Open (" Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=C: \ Users \ \ PC Desktop, create ACCESS database using code and Data table, with the code to create ACCESS database and Data table \ bin \ Debug \ database. The MDB. Persist Security Info=False ")
AccessPath="C: \ Users \ \ PC Desktop, create ACCESS database using code and data table, with the code to create ACCESS database and data table \ bin \ Debug \ database. MDB"

SPath="C: \ Users \ \ PC Desktop \ shuruwenjian XLSX"
Call the Execute (" select * into control parameters From [$] control parameters In '" & amp; SPath & amp; "8.0" 'Excel; '
")MsgBox (" export success, "vbOKOnly," tip ")
The Close ()
The db=Nothing

But prompt "external table is not the expected format error source is Call the Execute (" select * into control parameters From [$] control parameters In '" & amp; SPath & amp; "8.0" 'Excel; '") visual is excel version of the problem statement I excel is 2016 version should be how to modify the code, please

CodePudding user response:

This look for me, I have written: QQ 2776478814

CodePudding user response:

refer to 7th floor xiaoyao961 response:
this looking for me, I have written: QQ 2776478814


Don't look for you

CodePudding user response:

I ask questions before nobody willing to help

Then working out the

First open the EXCEL display in the grid
And then the data in the GRID cycle saved to the database
Fix

The only problem is the number of later puzzling how many 000
Such as guide in becomes 5.3 5.30000000000000001 or 5.299999999999999999999
Then use the FORMat to take two to solve

CodePudding user response:

Try:

The Open (" Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=C: \ Users \ \ PC Desktop, create ACCESS database using code and Data table, with the code to create ACCESS database and Data table \ bin \ Debug \ database. The MDB. Extended Properties=8.0 "" Excel; HDR=Yes; IMEX=1 ""; Persist Security Info=False ")

Call the Execute (" select * into control parameters From [$] control parameters In '" & amp; SPath)

CodePudding user response:

references 9 f jainkai response:
I ask before nobody willing to help

Then working out the

First open the EXCEL display in the grid
And then the data in the GRID cycle saved to the database
Fix

The only problem is the number of later puzzling how many 000
Such as guide in becomes 5.3 5.30000000000000001 or 5.299999999999999999999
Then use the FORMat to take two to solve

Why "is displayed in the grid" in first?
Directly read data from the workbook, not write access!
Don't you is to make the "control" of data load Excel workbook for you?

CodePudding user response:

In theory should be able to directly import
If not
Can use excel to import control
  • Related