TransferSpreadsheet Macro (1 Viewer)

roccoau

Registered User.
Local time
Tomorrow, 03:24
Joined
Sep 1, 2006
Messages
56
Hi,
I have a TransferSpreadsheet Macro where I import a spreadsheet on click of a command botton.
The settings are
Transfer Type: Import
Spreadsheet Type: MS Excel 5-7
Table Name: XYZ
File Name: C\Documents and Settings\Home\MyDocuments\XYZ.xls
Has Feild Names: Yes
Range: (nothing)

Is there anyway of importing this spreadsheet & automaticlly assigning a unique ID feild with an AutoNuumber Data Type or does an ID feild have to be added in the spreadsheet first ???
Also can you automatically assigne a Primary Key via this same macro ? or do you do it manually after import.
Thanks for any help or ideas.
 

boblarson

Smeghead
Local time
Today, 10:54
Joined
Jan 12, 2001
Messages
32,059
Import it to an existing table that has a PK field.
 

roccoau

Registered User.
Local time
Tomorrow, 03:24
Joined
Sep 1, 2006
Messages
56
Import it to an existing table that has a PK field.

Thanks Bob,
Yes that does it but the import just adds to the data already in the table. I wanted to start with fresh data everytime I import the new spreadsheet.(Pk to start at 1 each time)
My macro starts with a deleteObject before it imports the new spreadsheet so I start with fresh data, but this wipes out the PK feild.
Is there another way around this ?

Tks for help
 

boblarson

Smeghead
Local time
Today, 10:54
Joined
Jan 12, 2001
Messages
32,059
For one, for the PK, it shouldn't matter what number it is. That SHOULD be irrelevant. Check out the posts by the Doc Man for info around that. You should be able to just use a delete query to delete the data within the table and not delete the table. If you are assigning meaning to the PK, then it's a 98% chance you aren't using it correctly.
 

roccoau

Registered User.
Local time
Tomorrow, 03:24
Joined
Sep 1, 2006
Messages
56
Yes Bob your right it does not matter waht number the PK is. I am just having trouble with the delete macro as it deletes the whole table first.
So I need to look at a delete query, I will try it out.
Thanks for the help.

Rgds
 

Users who are viewing this thread

Top Bottom