Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    May 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pause in Calculations (2000)

    I have an event procedure which opens a form based on a user defined criteria, counts the records and closes the form if there are no records meeting the criteria. The form opens, but the event procedure closes it before it finishes calculating the number of records. Is there someway to add a pause so procedure doesn't get ahead of itself. Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Pause in Calculations (2000)

    Can you post the code you are using?

  3. #3
    New Lounger
    Join Date
    May 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pause in Calculations (2000)

    Thanks for the help. Here's the latest version I tried...

    DoCmd.RunMacro stDocName
    stRecCount = Forms![frmReportsSearch]![RecordCount1]
    If Forms![frmReportsSearch]![RecordCount1] > 0 Then
    Exit Sub
    End If
    DoCmd.Close
    MsgBox "No matches were found."

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Pause in Calculations (2000)

    You could put in a Do loop to check if the form is still loaded using the IsLoaded function.

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Pause in Calculations (2000)

    Here is some code that does a similar job. Instead of opening the form, then checking how many records there are, it checks first.
    The form is only opened if there are records.

    <pre> If DCount("[Projectid]", "tblProjects", strLinkCriteria) > 0 Then
    DoCmd.OpenForm stDocName, , , strLinkCriteria
    Else
    MsgBox ("No Projects match the criteria entered.")
    End If
    </pre>

    strLinkCriteria holds the user defined criteria.
    Regards
    John



  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Pause in Calculations (2000)

    What is in the macro stDocName?

    The simplest way to pause the code is to open the form as popup and modal. That will turn processing over to the form until it closes and then continue in the procedure that opened it.
    Charlotte

  7. #7
    New Lounger
    Join Date
    May 2003
    Location
    Washington, District Of Columbia, USA
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pause in Calculations (2000)

    That worked - thanks for the help.

    <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •