How Do I autoupdate a form

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

Guest

I have a form showing name and address, on the form I have a command button
that prints the specific record I am looking (either to printer or screen)

However if I change any data I have to go forward one record then back one,
so it "repaints" the form - (not sure if repaint is the correct term)

I would like it to repaint the object included in the command button - so
one click does all?
 
I bet you will get a better answer from someone else but just in case...

I think you can add a bit of VB code to the command button you mention. I
think if you add the line:

Me.Requery

to the On_Click event it will update all the controls on the form. I suppose
you could create a new command button (let's call it 'cmdRefresh') and add
this code to its On_click event first. Then you could see if clicking on the
'Refresh' button does indeed "repaint" the form then you could print it. If
the Me.Requery does work from the 'cmdRefresh' button, then you could delete
that button and add the code to your existing button. Hope this helps.
 
CP said:
I have a form showing name and address, on the form I have a command button
that prints the specific record I am looking (either to printer or screen)

However if I change any data I have to go forward one record then back
one,
so it "repaints" the form - (not sure if repaint is the correct term)

I would like it to repaint the object included in the command button - so
one click does all?

You could add the line

If Me.Dirty Then Me.Dirty = False

to the Click event of the button, just before you open your report.

Carl Rapson
 
Worked great many thanks :)

Steven Sutton said:
I bet you will get a better answer from someone else but just in case...

I think you can add a bit of VB code to the command button you mention. I
think if you add the line:

Me.Requery

to the On_Click event it will update all the controls on the form. I suppose
you could create a new command button (let's call it 'cmdRefresh') and add
this code to its On_click event first. Then you could see if clicking on the
'Refresh' button does indeed "repaint" the form then you could print it. If
the Me.Requery does work from the 'cmdRefresh' button, then you could delete
that button and add the code to your existing button. Hope this helps.
 
Back
Top