Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to wait for record count before copy 1

Status
Not open for further replies.

Aximboy

Technical User
Aug 3, 2003
63
US


I have a Form1 with a command button that opens Form2.
Form2 displays the record count in the form footer.
Then I have a code that copies the record count on Form2 back to a textbox in Form1.
My problem is, Access copies the record count right away before the Form2 even calculates the record count. That’s why I always get a “0” value.
I even put a 5 to 10 seconds timer with no success. It still copies before the form is done counting the records.
Any help how I can solve this?
Thanks in advance.
 
Find the place in your code where Form2 calculates the record count, and then display it in Form1


---- Andy

There is a great need for a sarcasm font.
 
Thank you for responding. Isn't the calculation of record count built in the forms? So I don't know where it is.
 
So what's your code where you call Form2 and where you display record count in Form1?


---- Andy

There is a great need for a sarcasm font.
 
So from Form1, I have...

Command16_Click ()
DoCmd.OpenForm "Form2"

Forms!Form1!Text3 = Forms!Form2!Text4

End Sub
 
If you place a brake on the line:
[tt]Forms!Form1!Text3 = Forms!Form2!Text4[/tt]
where does your logic go if you step thru the code?
Does it continue loading Form2?


---- Andy

There is a great need for a sarcasm font.
 
It loads but record count doesn't calculate first before copying to Form1.
 
A record count should be available from a simple DCount() rather than through a form. I assume you are counting the number of records in the Record Source of Form2. Why do you need to open the form? What is the record source of Form2?

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
OMG, I did not thought of that!
The only reason I'm loading Form2 is to get a record count.

Thank you so much Mr. dhookom!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top