how do I get the form's table to update with a button?

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

Guest

I have a form with which users can change values in the underlying table.
(form fields are bound to the fields of the table)

Usually the changes the user made in the form fields won't take effect until
the user goes to the next record. But I need to have the values in the table
changed when the user hits a button (that runs a macro, I guess) on the form.
(The user must stay on that record and still have his changes take effect in
the underlying table.)
 
PaulFort said:
I have a form with which users can change values in the underlying
table. (form fields are bound to the fields of the table)

Usually the changes the user made in the form fields won't take
effect until the user goes to the next record. But I need to have the
values in the table changed when the user hits a button (that runs a
macro, I guess) on the form. (The user must stay on that record and
still have his changes take effect in the underlying table.)

In the Click event of the button...

Me.Dirty = False
 
OK, I'm not gettin it:
When I put that code (me.dirty = false) into the On Click event for that
button on the form (that also calls for the running of a macro that does some
appending to a table)...and click the button I get an error:
MS Access can't find the macro Me.

thanks
 
PaulFort said:
OK, I'm not gettin it:
When I put that code (me.dirty = false) into the On Click event for
that button on the form (that also calls for the running of a macro
that does some appending to a table)...and click the button I get an
error:
MS Access can't find the macro Me.

thanks

VBA code doesn't go directly into the event property box. You enter "[Event
Procedure]" which is one of the drop down choices and then press the builder
[...] button to the right. That will take you to the VBA code window
positioned between the two pre-created lines that define the start and end
of the procedure for your event. Your code goes between those two lines.
 
OK, I'm not gettin it:
When I put that code (me.dirty = false) into the On Click event for that
button on the form (that also calls for the running of a macro that does some
appending to a table)...and click the button I get an error:
MS Access can't find the macro Me.

thanks

Remove the line me.dirty = false from the property...
click the ... icon by the property...
invoke the Code Builder...
and type the line *in the subroutine*. Access will give you a Sub and
an End Sub line; just put that line of code between them.

Select Debug... Compile <my database> and then save the form.


John W. Vinson[MVP]
 
Back
Top