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

append query is doing an update 1

Status
Not open for further replies.

sawilliams

Technical User
Aug 23, 2006
98
US
This is weird. I am running an append query from a parameter on a form. It works fine except it updates the first record in the appended table. This is the scenario. I am adding event attendance information for customers by adding the customer number and event name to the events table. If customer #1 already has an event called "A-LIST PARTY", (even if he is not on the new invite list), this first entry for the first customer in the events table will be updated to the name of the new Event. I deleted all of Customer #1's event information and ran the append query again, now the first event of Customer #2 gets updated to be the name of the new event. So, my query is updating only the first row in the table and appending all the other rows properly.

Here is my sql for the query:

PARAMETERS [forms]![form1].[Event] Text ( 255 );
INSERT INTO tblEventAttendance ( Cust_ID, Event )
SELECT tblListBuilder.Cust_ID, [forms]![form1].[Event] AS EventName
FROM tblListBuilder;

Help would be greatly appreciated.
 
Never heard of an INSERT changing existing records. Are you sure that it's not just adding another record?

Try this statement

Code:
Select CustID, Event
From tblEventAttendance 
Where CustID = 2    [red]<-- Change this to the correct value[/red]
Order By CustID, Event
and check if you have duplicate records.
 
I did check for dupes and that is not the problem, but the problem is even more mysterious. After I posted my question, I noodled with this for hours and finally discovered that the append query is not the problem. After I run the append, the table is corrected added to. BUT, when I run a SELECT query from a form, it displays accurately what is on the table in question (Customers attending the Event) but when I close the query, the first row of the Event table gets updated. So weird! It's just a select query, running from a parameter on a form. Even if I run the append part, close the db, compact and repair, when I run the SELECT query, that first record gets updated. I'm flummoxed!

 
Is the Form you are using to do the append query also bound to the table?
 
Yes...

I unbound it and it that seems to have been my problem all along. Thanx cmmrfrds. Your tip was invaluable!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top