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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Avoiding an Alert Message 1

Status
Not open for further replies.

heeleyj

Technical User
May 17, 2001
12
US
I have a macro that imports text to a table to update the table with new data. The import works perfect accept Access gives me the following message:

"The contents in fields 0 record(s) were deleted, and ##### records were lost due to key violations. *If the data you pasted or imported doesn't match the field data types or the FieldSize property in the destination table. *If the record were lost, either the records you pasted contain primary key values that already exist in the destination table, or they violate referential integrity rules for a relationship defined between tables. Do you want to proceed anyway?. [Yes] [NO] [Cancel]"

I have checked the data being imported and it is fine. I'm sure I have garbage from DOS that is causing validation issues as well as having pre-existing values in the table. So my data and import functions are fine. I just want to know how I can hide this error message or turn it off so that it does not cause concern to the users. Any help would relive stress and nervousness of others!!! Thanks in advance for your help!
 

In the macro run the SetWarnings On = No action before any update commands. Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Thank YOU! I have a second question related to the first. How do I get the text file to replace existing primary key information? Explanation: My primary key is set on item number however there is a cost field associated with every item number. My new text file will have the newest cost associated with item number that pre-exist in the table. Can I get the import to overwrite the ones that have changed?
I would if I could!! Thanks!
 
I would suggest importing the data into a temp table (duplicate of the final destinantion) and then run an update query where a matching record is found in the destination table. Remember to also do an append if there is a chance of new records. Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top