Solved

MS Access Need help with requery in VBA

Posted on 2013-05-30
14
349 Views
Last Modified: 2013-05-31
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
Comment
Question by:DJPr0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39208396
you need two lines, one for each requery

Table1.Requery
Table2.Requery
0
 
LVL 11

Expert Comment

by:John Easton
ID: 39208399
I assume this is part of a function.  Therefore just add the second requery on the next line.  Therefore:

Table1.Requery
Table2.Requery
0
 

Author Comment

by:DJPr0
ID: 39208440
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:peter57r
ID: 39208445
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39208466
try this

Private Sub Form_Timer()
Forms!Form1.Requery
Forms!Form2.Requery
End Sub
0
 

Author Comment

by:DJPr0
ID: 39208645
Error says it cant find Form1.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39208662
DJPr0,

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

you were using  

Form1.Requery
Form2.Requery

in your codes!!!!
0
 

Author Comment

by:DJPr0
ID: 39208797
I did not use form1 and form2 in the codes, I'm using form1 & form2 for representation only.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39208814
then how are we gonna know the names of your forms?
0
 

Author Comment

by:DJPr0
ID: 39208852
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39209065
which form event did you place your code?

Private Sub Form_Timer()   '< what is the name of the form that have this sub?
0
 

Author Comment

by:DJPr0
ID: 39209229
The main form is "open projects" due to the fact I have tabs with many forms inside.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39209270
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
 

Author Closing Comment

by:DJPr0
ID: 39210517
Thanks capricorn1!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question