Results 1 to 4 of 4
  1. #1
    lupis is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    23

    Pausing macro execution


    I have a form with a macro that has the action "SendObject" that sends a report by email. In the report itself I have macro that displays a messagebox if no records were found.

    What I want o achieve is to halt the "SendObject" macro if no records were found and stop loading Outlook, instead display the parameter box for the report once more to let the user input a valid string after the messagebox that warns for No Records

    -Sohail

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Check o see if you have any records first.

  3. #3
    lupis is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    23
    I am already doing this by the following code:

    Code:
    Do
      intNumOfRecs = DCount("*", "qSalesQueryLastName", "[Name] = '" & varName & "'")
     
      If intNumOfRecs = 0 Then
        intResponse = MsgBox("No Records exists for a Name of [" & varName & "], try again?", _
                              vbQuestion + vbYesNo + vbDefaultButton1, "Parameter Prompt")
          If intResponse = vbYes Then Me![txtName].SetFocus: Exit Sub
      Else
      'Record(s) exist, Run Macro or execute code here

  4. #4
    lupis is offline Novice
    Windows 7 Access 2007
    Join Date
    Mar 2010
    Posts
    23
    My problem is that the outlook form gets focus and cant be minimzed so I cant see the report generated in access

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need help with macro
    By abc123 in forum Programming
    Replies: 6
    Last Post: 06-13-2010, 12:34 AM
  2. MACRO help please
    By DianeG in forum Forms
    Replies: 2
    Last Post: 04-20-2010, 07:19 AM
  3. Pausing a Macro
    By Rick West in forum Programming
    Replies: 0
    Last Post: 03-17-2010, 10:29 AM
  4. Get Function to run as a macro
    By randolphoralph in forum Programming
    Replies: 11
    Last Post: 01-24-2010, 12:30 AM
  5. import using Macro
    By johnny1g in forum Import/Export Data
    Replies: 1
    Last Post: 09-15-2009, 04:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums