Refresh form

eugz

Registered User.
Local time
Today, 18:23
Joined
Aug 31, 2004
Messages
128
Hi all
I have a Form1 with ListBox1 where user select data and button that open Form2 with ListBox2 that will display data depends from selection. My problem is: how to open and refresh data in Form2 simultaneously?
Thanks.
 
did you try to refresh your Form2 in the OnLoad event of your Form2 ?
 
Form 2 will automaticaly refresh when it is opened!

Peter
 
Hi all
Thanks for replay.
I will specify exactly what I want to get. When user will open Form2 he/she has opened Forms1 & Form2 . Then user make new selection on Form1. In this place I have problem. User will press button to get new result, but result doesn't change. My problem is: how to refresh data in Form2 ?
Thanks.
 
Hi
I insert Forms!YourForm2Name.Requery in
Code:
Private Sub cmd_Button_Click()
    DoCmd.OpenForm "Form2"
    Forms!YourForm2Name.Requery
End Sub
But it doesn't change result.
Thanks.
 
my post was just an example, replace the form name with that of your own form
 
Hi
Of course my code is
Code:
[COLOR=DarkGreen]Private Sub cmd_Button_Click()
    DoCmd.OpenForm "Form2"
    Forms!Form2.Requery
End Sub[/COLOR]
Thanks.
 
Is form2 a "Modal" form? as this would stop the code running until it is hidden again.

Peter
 
Hi all.
Thanks for replay.
My code of Form2 for ListBox2 is:
Code:
[COLOR=green]
Private Sub Form_Load()
    ListBox2.RowSource = "Select Field21_Id,Field22 from View2 where Field11_id = " + Form1.ListBox1.Value
    ListBox2.Requery
End Sub 
[/COLOR]
When I update my code of Form1 like you suggested:
Code:
[COLOR=green]
Private Sub cmdButton1_Click()
    DoCmd.OpenForm "Form2"
    Forms!Form2.ListBox2.Requery
End Sub
[/COLOR]
the result of ListBox2 Form2 didn't changed.
 
just guessing but try
Private Sub Form_Load()
ListBox2.RowSource = "Select Field21_Id,Field22 from View2 where Field11_id = " & Form1.ListBox1.Value
ListBox2.Requery
End Sub

Is Form1.ListBox1.Value numeric or string data?

Peter
 

Users who are viewing this thread

Back
Top Bottom