Run Update Query Using the Where Clause

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to run an update query that update a field only on the current form
which is a continuous form.

Is this possible and if so, do I do this in the SQL of the query and I'm not
sure how.

This is what I have for the SQL text of the query:

UPDATE InventoryTransfersFromForm, InventoryTransfersQuery SET
InventoryTransfersFromForm.BinQuantity =
[InventoryTransfersFromForm]![BinQuantity]-([InventoryTransfersQuery]![QTYTransfered]);

The update query works, but it updates all records on the form, previous and
current.
 
I want to run an update query that update a field only on the current form
which is a continuous form.

Is this possible and if so, do I do this in the SQL of the query and I'm not
sure how.

This is what I have for the SQL text of the query:

UPDATE InventoryTransfersFromForm, InventoryTransfersQuery SET
InventoryTransfersFromForm.BinQuantity =
[InventoryTransfersFromForm]![BinQuantity]-([InventoryTransfersQuery]![QTYTransfered]);

The update query works, but it updates all records on the form, previous and
current.

It's not clear what you want to update: this individual record, or all
the records currently displayed on the subform. If the former:

UPDATE InventoryTransfersFromForm, InventoryTransfersQuery SET
InventoryTransfersFromForm.BinQuantity =
[InventoryTransfersFromForm].[BinQuantity]-([InventoryTransfersQuery].[QTYTransfered])
WHERE <key field> = Forms![MainFormName]![SubformName].Form![Control]

If the update should be for all subform records, use

=[Forms]![MainFormName]![LinkingFieldName]

using the name of the field that is your Master Link Field for the
subform.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top