Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery a control on another open form

Status
Not open for further replies.

jmstarbuck

Programmer
Aug 11, 2003
90
US
I have two mainforms that are open at the same time. When
I update the value of a field on Form2, I want to requery a control on Form1 (LBJobs).

I am able to do it in the Form2 Close event but not in the AfterUpdate event of a control on Form2.

This is what I am trying to make work:
Code:
Forms!Form1!LBjobs.Requery
It does make the control I'm trying to requery flicker on Form1.

Thoughts?
 
Is it possibly because your control has been updated but the record on Form2 hasn't been saved? You might want to add a line of code to save the current record and then requery the control on the other form.

Duane
Hook'D on Access
MS Access MVP
 
Use the AfterUpdate event procedure of the Form.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for the suggestion. That sounds like it is on the right track.

I inserted:
Code:
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

in the Form2.Control AfterUpdate event prior to the requery of the control on Form1

Unfortunately it hasn't helped. Is that the kind of save you were thinking of?
 
Hi again,

I did try moving the control requery to the Form's AferUpdate event and it didn't change anything.

The reason I think that the requery is not happening is that I can look at the control on Form1 while Form2 is up. I can see the control flicker but the data doesn't change...

This seems to be a really basic need. I'm sure it is something that should be easy...

J
 
More info...

I have found that putting the requery in the Form2 AfterUpdate event does make Form1 update when I move to the next record on Form2.

I've tried to make the Form2 control's AfterUpdate event call the Form2 AfterUpdate event, but that isn't doing it.

 
How are ya jmstarbuck . . .

Your [blue]depending on requery to update the form1 control[/blue]. This would work if you updated LBjobs in the underlying table of form1 ... for the current record in form1. So requery is not what you need here. Just simple transfer the data! Example:
Code:
[blue]   Forms!Form1!LBjobs = Me!Form2ControlName[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hey guys, thanks for your help. Here's what finally worked for me:

If Forms!job_form.Dirty = True Then
Forms!job_form.Dirty = False
Forms!Application_Form!LBjobs.Requery
End If

The save as I was originally doing it wasn't working.

I really appreciate the assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top