Macro running an update query in a form

  • Thread starter Thread starter SMatthew
  • Start date Start date
S

SMatthew

I am trying to use a macro which runs an update query in
a form. The problem I am facing is the update query and
the macro when run individually works fine. But in the
form, which runs this macro using a textbox's afterupdate
method does not update the record in the table the first
time. But when I change another data in the text box on
another record, this record does not get updated but the
previous updated record is updated in the table. Could
you tell me what I am doing wrong?
 
SMatthew,

It sounds like you are running an Update Query to update the same
record as the one you are currently entering. Yes? If so, the Update
Query probably can't update that record because the record doesn't
exist yet, as it hasn't been saved to the table yet.

In your macro, before the (presumably) OpenQuery action, try putting a
RunCommand, SaveRecord action.

I would be interested to know what you are doing this for... on the
face of what you have told us so far, this is a very unusual thing to
do!

- Steve Schapel, Microsoft Access MVP
 
Back
Top