Update Query for Current Record

G

Guest

I want to run an update query for the current record in a form by clicking a
command button. When I do this, I get a prompt letting me know that the
current record is being changed by another user. Is it possible to override
this prompt using code?
 
A

Allen Browne

You could start by making sure any changes are saved in the form before you
also try to change it in the Update query, i.e.:
If Me.Dirty Then Me.Dirty = False
dbEngine(0)(0).Execute "MyUpdateQuery", dbFailOnError

That could still fail under some circumstances. If you are just changing the
record in the form, why not assign values to its controls/fields instead of
running an update query?
 
G

Guest

That's sounds like a much better idea. What would be the best way to go about
doing that? (just a nudge in the right direction would be much appreciated)

Thanks,
Murp
 
A

Allen Browne

If you have a form named "Form1", with a text box named "City", the code
would be:
Forms![Form1]![City] = "Springfield"
 

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