Record update

B

Ben

Hi all,

I have a form that is attached to a table. There is combo box associated
with one of the fields. I wrote some code in the On Change event of the
combo box, so that as soon as the value in the combo box changes, the code in
the On Change event causes the values in other fields to changes as well,
those fields are not on the form. However, when I ran the report, the values
in those did not change, but I noticed that I have to physically move away
from the record with the record selector. When I do that I see the field
values gets updated right away and when I ran report again, the values
appears correctly.

Is there a way to force the update to take place as soon as the value in the
combo box changes using code without moving the record selector?

Thanks,

Ben
--
 
M

Marshall Barton

Ben said:
I have a form that is attached to a table. There is combo box associated
with one of the fields. I wrote some code in the On Change event of the
combo box, so that as soon as the value in the combo box changes, the code in
the On Change event causes the values in other fields to changes as well,
those fields are not on the form. However, when I ran the report, the values
in those did not change, but I noticed that I have to physically move away
from the record with the record selector. When I do that I see the field
values gets updated right away and when I ran report again, the values
appears correctly.

Is there a way to force the update to take place as soon as the value in the
combo box changes using code without moving the record selector?


You can use the line of code:
If Me.Dirty Then Me.Dirty = False
to save any changes to the current record.

Are you certain that you want to use the combo box's Change
event for this? If a user types an entry, the event will
fire for every keystroke. The AfterUpdate event is almost
always better.
 
B

Ben

Marshall,

Works great!

Thank you.

Ben



--



Marshall Barton said:
You can use the line of code:
If Me.Dirty Then Me.Dirty = False
to save any changes to the current record.

Are you certain that you want to use the combo box's Change
event for this? If a user types an entry, the event will
fire for every keystroke. The AfterUpdate event is almost
always better.
 

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