Form Refresh

T

tiyago

Hey everyone,

I have a form (form1) that has a button which calls another form (form2).
Form2 is adding a record to the database and is been open without closing the
form1 (on to of form1).
What happens is that the after closing form2, form1 does not “see†the new
record. I have to go to “Records†then “Refresh†to have form1 “see†the new
record. How do I do that in VB?

Thanks,
 
A

Allen Browne

Use the AfterUpdate event procedure of the Form (i.e. form2) to Requery
form1:

Private Sub Form_AfterUpdate()
Forms.form1.Requery
End Sub

Note that a requery reloads all records, form1 will then be showing the
first record. If you want to find the same record again, you need to save
the primary key value into a variable, and then FindFirst in its
RecordsetClone.
 

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