MS Access Need help with requery in VBA

The statement below in my VBA works fine.

Table1.Requery

How can I add another table to the above statement?
Example:
Table1 And Table2.Requery
DJPr0Asked:
Who is Participating?
 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
forms EmployeeWeeklyQueryDash and ProjectsNearClose are subform in the main form "open projects" ?

you could have mentioned that in your original post.


Private Sub Form_Timer()
Me.EmployeeWeeklyQueryDash.Requery
Me.ProjectsNearClose.Requery
End Sub
0
 
Rey Obrero (Capricorn1)Commented:
you need two lines, one for each requery

Table1.Requery
Table2.Requery
0
 
John EastonDirectorCommented:
I assume this is part of a function.  Therefore just add the second requery on the next line.  Therefore:

Table1.Requery
Table2.Requery
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
DJPr0Author Commented:
Not part of a function.

I receive an error: Object required

Code:

Private Sub Form_Timer()
Form1.Requery
Form2.Requery
End Sub

Open in new window

0
 
peter57rCommented:
Interesting- I don't think I've ever issued a Requery command for a table.

Can you explain the context in which you need to do it.
0
 
Rey Obrero (Capricorn1)Commented:
try this

Private Sub Form_Timer()
Forms!Form1.Requery
Forms!Form2.Requery
End Sub
0
 
DJPr0Author Commented:
Error says it cant find Form1.
0
 
Rey Obrero (Capricorn1)Commented:
DJPr0,

what are the names of the forms you want to requery????

you were using  

Form1.Requery
Form2.Requery

in your codes!!!!
0
 
DJPr0Author Commented:
I did not use form1 and form2 in the codes, I'm using form1 & form2 for representation only.
0
 
Rey Obrero (Capricorn1)Commented:
then how are we gonna know the names of your forms?
0
 
DJPr0Author Commented:
This works:
EmployeeWeeklyQueryDash.Requery

This says cant find form (EmployeeWeeklyQueryDash):

Private Sub Form_Timer()
Forms!EmployeeWeeklyQueryDash.Requery
Forms!ProjectsNearClose.Requery
End Sub

Open in new window

0
 
Rey Obrero (Capricorn1)Commented:
which form event did you place your code?

Private Sub Form_Timer()   '< what is the name of the form that have this sub?
0
 
DJPr0Author Commented:
The main form is "open projects" due to the fact I have tabs with many forms inside.
0
 
DJPr0Author Commented:
Thanks capricorn1!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.