Data Import Problem With Acess 2007

A

Aamer

I have made a button on the switch board to export the data with the
following Code.

Private Sub Export_Data_Click()

Dim CurrentDay As String
Dim CurrentMonth As String
Dim CurrentYear As String
CurrentDay = Day(Now)
CurrentMonth = Month(Now)
CurrentYear = Year(Now)


DoCmd.OutputTo acOutputTable, "Purchases", "ExcelWorkbook(*.xlsx)",
"C:\Reports 2010\Purchase 2010 (" + CurrentDay + "-" + CurrentMonth + "-" +
CurrentYear + ").xlsx", False, "", 0, acExportQualityPrint
DoCmd.OutputTo acOutputTable, "Sales", "ExcelWorkbook(*.xlsx)", "C:\Reports
2010\Sale 2010 (" + CurrentDay + "-" + CurrentMonth + "-" + CurrentYear +
").xlsx", False, "", 0, acExportQualityPrint



Export_Data_Exit:
Exit Sub

Export_Data_Err:
MsgBox Error$
Resume Export_Data_Exit

End Sub

This works Fine, and the data is backed up on excel file

later when i try to update data on another computer or even on the same
computer I get the following error



I have created a button on the switchboard with the code

Private Sub Import_Data_Click()

DoCmd.RunCommand acCmdImportAttachExcel

End Sub

I run this code. give the file path, And choose "Append a copy of the
records to a table" and select "SALES" as for sales backup to be updated.
Then I get the following "ERROR".

The first row contains some data that cant be used for valid access field
names in these cases, the wizzard will automatically assign valid field names.
Then I clik Ok

and The Wizzard Opens, "First Row Contains CoIumn Headings" is loked, Then
click NEXT, Confirm Import Table To Sales. & Hit Finish.

I get Error again.
Field "GP Dated" does not exist in the destination table "Sales" Clik OK
(THIS FILE DOES EXIST IN THE DESTINATION TABLE)
Again Another Error
"An error occurred trying to import file C:\ users....... \Sale 2010
(7-5-2010).xlsx. The file was not imported
Hit OK.



Now. I have exported a Sale in xlsx format using wizzard and then delete the
contents, then copy & paste the contents of the file i exported by the above
mentioned code. It updates the Database without any problem.
So Far I am using this techneque but this is not the solution.



Cansomeone help me fix this problem.
 
J

Jerry Whittle

I do not see the error that you mention. If you are trying to post an image
of it, this will not work. You'll need to type in the error message.
 
A

Aamer

The following is the error I am getting

The first row contains some data that cant be used for valid access field
names in these cases, the wizzard will automatically assign valid field names.
Then I clik Ok

and The Wizzard Opens, "First Row Contains CoIumn Headings" is loked, Then
click NEXT, Confirm Import Table To Sales. & Hit Finish.

I get Error again.
Field "GP Dated" does not exist in the destination table "Sales" Clik OK
(THIS FILE DOES EXIST IN THE DESTINATION TABLE)
Again Another Error
"An error occurred trying to import file C:\ users....... \Sale 2010
(7-5-2010).xlsx. The file was not imported
Hit OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top