Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro trouble 1

Status
Not open for further replies.

slh020

Technical User
Oct 14, 2005
22
US
Need help...please..I have a small table that I am using a macro to (1)delete old records from table, (2)transfer text (text.csv file with quotation marks as delimiter) to same table. My problem is when I use the macro (it does work) it will append the new data with the delimiter (""). I have changed the import specifications several times but nothing seems to work. I am new to access so I'm sure this is something pretty simple but it has frustrated me to no end. I have a delete old data query and an append new data query but when I used the append query it would not work correctly so I am now using the transfer text action. Does anyone have any ideas??? Sorry for the long post but I am lost...I am using Access 2000. Thanks in advance....

Code:
[b]Actions[/b]
OpenQuery  -  using delete old data query
Transfer Text  - using text.csv file with ""delimiter
MsgBox  - Update complete!

[b]Arguments[/b]
QueryName - Otime delete
View - Datasheet
DataMode  - Edit
TransferType - Delimited (I tried fixed width also..no go)
 
[b]Delete Query[/b]
DELETE DISTINCTROW table.*
FROM table;
[b]Append Query[/b]- could not get it to work correctly
INSERT INTO table ( LastName, FirstName, Department, Title, Amt, Sex, Bldg, Shift )
SELECT table.LastName, table.FirstName, table.Department, table.Title, table.Amt, table.Sex, table.Bldg, table.Shift
FROM table;

 
You need to set up and import specification, then use it in your macro.

Import your file manually with File/Get External data etc.
The Wizard will come up to a screen that says "Your data seems to be in a 'Delimited Format'....

At the bottom left is an Advanced button. Clicky.

The advanced screen has a bunch of options you can set for your import. Defaults should be fine, but make sure your Field Delimiter and Text qualifier are set okay (quote and comma respectively)

Now click the "Save As" button at the right of the specifications screen. Give it an easy name. You don't need to specify an extension. Once you've done this, you can cancel out of rest of the import process.

Now go back to your macro and edit the Import step. Down at the bottom where you specify the file name and stuff, you'll see a spot to put in your specification file name. Put that in, save your macro, and all should be fine.




 
Thank you BaudKarma..it now works....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top