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

Update Query

Status
Not open for further replies.

nike2000

Technical User
Apr 1, 2003
61
GB
I have a form that displays records filtered by a Combo Box on a previous screen.
I want to build an Update Query on the this Form that will update these records.
I have built the Update Query for this and it runs from a Command Button, but it updates all of the records not the selected filtered records above!!
How can I just update those records that have been filtered and displayed on this form?
Thanks,
Nike
 
If the 'previous' form is still open, use the combo box as criterion in the query.

If not, when opening the 'filtered' form, pass the value of that combo box to the form through OpenArgs:

DoCmd.OpenForm "FormName", , , "Condition", , , Me![ComboBoxName]


Use OpenArgs as criterion for the corresponding field in your update query:

Forms![YourForm].OpenArgs

That should do the trick

Good luck


[pipe]
Daniel Vlas
Systems Consultant

 
Hi Daniel,
The form is still open.
The name of the form is 'Form_MainMenu'.
The name of the Combo Box is 'Combo35'.
The SQL of the query is:

UPDATE Tbl_PV_Details SET Tbl_PV_Details.TraderApproval = True;

How can I place the Combo Box criteria in the query?

Thanks for getting back to me,
Nike
 
UPDATE Tbl_PV_Details SET Tbl_PV_Details.TraderApproval = True Where [FieldFromTable] = Forms![Form_MainMenu]![Combo35];

FieldFromTable is the name of the field by which you filtered the records in the second form.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Harry,
excellent it worked a treat!!!
thank you very much.
one more question....

how could i update the individual records on the continuous form??

thanks,
Nike
 
Same technique:

UPDATE Tbl_PV_Details SET Tbl_PV_Details.TraderApproval = True Where [RecordID] = Forms![ContinuousForm]![RecordIDControl];

This will update the row corresponding to the RecordID from the currently selected record on the form.

By the way...who's Harry???

[smile]




[pipe]
Daniel Vlas
Systems Consultant

 
Harry,
sorry Daniel, I call everyone Harry its just an expression that i use. its a terrible habit. sorry
thanks again. the tip worked perfectly.
all the best,
Nike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top