Lyconal
06-02-2009, 05:27 AM
Hi,
I need an UPDATE Query to ONLY update the one record in a table, based on the information on the CURRENT FORM only (Not the rest of the records available from this form)
Anybody know how to do it?
Cheers
namliam
06-02-2009, 05:42 AM
Why not update the record that is on the form currently??
You can retrieve anything from the form using Forms("Formname")!ControlName
Lyconal
06-02-2009, 05:52 AM
I basically need it to update a value in another table, based on what is happening on the current form (That value is not available on the form, although its table is linked)
I have tried the forms("formname"!ControlName, and it works, but it runs the update query with all records in mind, not the one that is currently open on screen (If that makes sense?)
namliam
06-02-2009, 06:55 AM
Forms("Formname")!ControlName can only fetch the value that is currently selected, so you just have to make sure to fetch the PK for your table to get the right update to happen.
Alternative, add the column you need (hidden) to the form, then alter it there.
Lyconal
06-02-2009, 07:16 AM
Ok - So I have added the column that I need hidden, and now the update query works (If I manually enter the values and dont run it from the form) - If I run it from the form it doesnt work.
Any ideas?
Lyconal
06-02-2009, 07:30 AM
NVM - I was trying to run it BEFORE saving the record, and was referencing the PK which obviously doesnt exist until the record is saved! DOH!
namliam
06-02-2009, 11:28 PM
Glad you got it working :)