Solved

MS Access Need help with requery in VBA

Posted on 2013-05-30
14
330 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
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 10

Expert Comment

by:JEaston
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

786 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