Update SQL help please... (1 Viewer)

johntyyk3

New member
Local time
Today, 23:51
Joined
Sep 11, 2006
Messages
4
Hey all,

I have a problem with my update SQL,

The situation where it is used:

The SQL code is as a command on a button on a form. It is used to take the value in the text box(Name: Restock) and update it to the Quantity field in the table. (tblStock)

The problem is that the Update, updates all the records changing all the values in the Column (Quantity) to the value that is in the text box.

I need it to update the record which is displayed in the form not all the records.

Here is the SQL at the minute.

DoCmd.RunSQL ("UPDATE tblStock SET Quantity = (Restock) WHERE ItemID = [ItemID]")

Any help would be great. Thanks in advance
 

pdx_man

Just trying to help
Local time
Today, 15:51
Joined
Jan 23, 2001
Messages
1,347
What is the primary key on tblStock? That is what needs to be in your where clause.
 

Users who are viewing this thread

Top Bottom