Import Data . .

Evagrius

Registered User.
Local time
Today, 07:53
Joined
Jul 10, 2010
Messages
170
Hi, I am using the below code. How can I ajdust the code so that row one in excel is ignored? Row one cell one ("a1") has a date which I want to copy to a textbox in an access form - I am not sure how to do that;

Row two has the field names and the remaining rows have the data. Those I would like to simply transfer to the table. Thank you for any help!


Code:
Sub MyCopy()

DoCmd.SetWarnings False
DoCmd.RunSQL ("Delete FROM Table")
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "table", "a long file path with workbook name.xlsm", True
DoCmd.SetWarnings True

End Sub
 
it would be easier for you to use DAO after you import the excel table to throw the data from the first and second rows in the recordset where you want them and then simply delete them out.

that will take much less coding than hand-picking rows out of the .xls file to import.
 
I understand. I am sure how to do that - would you be willing to post a sample? Thank you!
 
Have you tried linking to the Excel spreadsheet?
Then you can treat it as an Access table.
 
I understand. I am sure how to do that - would you be willing to post a sample? Thank you!

yes I can. But how about using Peter's suggestion? That is about as easy as you can get....?

The only problem with it is that you cannot edit a linked table.
 
I would suggest you consider altering the ss layout so that row 1 has all the column headers.
Make Column A 'Date' and put the date, presumeably of last update the sheet, in 2A.
Access will table it with a wizard but make sure you choose the correct data types as it does.
 

Users who are viewing this thread

Back
Top Bottom