• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 366
  • Last Modified:

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
0
DJPr0
Asked:
DJPr0
1 Solution
 
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
Rey Obrero (Capricorn1)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
 
DJPr0Author Commented:
Thanks capricorn1!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now