Save Error Using Requery

S

Sharkbyte

I have a form tied directly to a table. I update a record, and need to
refresh the form. When I run .Requery, I get:

You must save the current field before you run the requery action.

Any suggestions on what code I need to add, for Access to see the record as
having been saved?

Thanks, in advance.

Sharkbyte
 
J

John Vinson

Any suggestions on what code I need to add, for Access to see the record as
having been saved?

Put a line

If Me.Dirty = True Then Me.Dirty = False

prior to the requery. This will force a save, if it's needed.

John W. Vinson[MVP]
 
D

Dirk Goldgar

Sharkbyte said:
I have a form tied directly to a table. I update a record, and need
to refresh the form. When I run .Requery, I get:

You must save the current field before you run the requery action.

Any suggestions on what code I need to add, for Access to see the
record as having been saved?

What event are you using to execute this requery? Maybe I'm wrong, but
I wouldn't think you'd get that message unless you were executing the
requery in the Change or BeforeUpdate event of a bound control, which is
not an appropriate time to do it. I *think* this message is telling you
that you have an uncommitted value in the control, which must be
committed before you save the record and requery. Could you give some
further details on exactly what's going on to trigger the error?
 

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

Top