×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How to wait for record count before copy

How to wait for record count before copy

How to wait for record count before copy

(OP)


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.

RE: How to wait for record count before copy

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.

RE: How to wait for record count before copy

(OP)
Thank you for responding. Isn't the calculation of record count built in the forms? So I don't know where it is.

RE: How to wait for record count before copy

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.

RE: How to wait for record count before copy

(OP)
So from Form1, I have...

Command16_Click ()
DoCmd.OpenForm "Form2"

Forms!Form1!Text3 = Forms!Form2!Text4

End Sub

RE: How to wait for record count before copy

If you place a brake on the line:
Forms!Form1!Text3 = Forms!Form2!Text4
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.

RE: How to wait for record count before copy

(OP)
It loads but record count doesn't calculate first before copying to Form1.

RE: How to wait for record count before copy

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

RE: How to wait for record count before copy

(OP)
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!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close