Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    May 2001
    Location
    Omaha, NE USA, Nebraska, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Howto: PopUp Form (Access 97/SR1)

    I have a piece of code that prints a set of reports, some of the reports are opened from Excel then printed. I am looking for a way to put a 'PopUp' form on the screen during the time that the code is executing.

    I created a small form to use as the popup form and named it frmWait. How do i go about coding in the load/show of the form, the call of the other sub (P22 is the other subs name), then the unload of the form.

    Here is what I have tried, but I get a variable not defined error. Upon clicking the 'debug' button the <font color=blue>frmWait</font color=blue>.Show gets highlited.

    <pre>Function p22a()
    frmWait.Show
    'Call P22
    Unload frmWait
    End Function
    </pre>


    What am I doing wrong. BTW, this is my first time attempting to open a form through code (does it show) <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> <img src=/S/question.gif border=0 alt=question width=15 height=15>

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Howto: PopUp Form (Access 97/SR1)

    You may want to try:<pre>DoCmd.OpenForm "frmWait", acNormal
    'Your Code Here
    DoCmd.Close acForm, "frmWait", acSaveNo</pre>

    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

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

    Re: Howto: PopUp Form (Access 97/SR1)

    Are you using VB or Access as the front end? The code you posted is VB code, and Mark's answer is Access VBA code.

    If it's VB, the Show method should work to both load and show the form but I believe you need the vbModal or vbModeless argument to make it work.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    May 2001
    Location
    Omaha, NE USA, Nebraska, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Howto: PopUp Form (Access 97/SR1)

    I inserted mark's code and tried the macro. The form comes up and the goes away like it should, however, all you see is an outline of the form. The middle of the form is all white. I have attached what the form looks like when running (bad_pic) and what the form should look like (good_pic) (I don't know if there is a way to upload two images, so I edited the previous post and attached the good_pic). Any ideas on what I am doing wrong.
    Attached Images Attached Images

  5. #5
    2 Star Lounger
    Join Date
    May 2001
    Location
    Omaha, NE USA, Nebraska, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Howto: PopUp Form (Access 97/SR1)

    I am using Access. Have not had a chance to try Mark's suggestion. Will get to it tomorrow.
    Attached Images Attached Images

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

    Re: Howto: PopUp Form (Access 97/SR1)

    Try a Me.Repaint in the form's open event.
    Charlotte

  7. #7
    2 Star Lounger
    Join Date
    May 2001
    Location
    Omaha, NE USA, Nebraska, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Howto: PopUp Form (Access 97/SR1)

    Edited by Charlotte to eliminate horizontal scrolling

    Charlotte, that didn't work. However, it triggered an obscure thought (very rare that this happens). What if I try to refresh the 'PopUp' form from in the middle of my other code. This did work.

    I listed below what I was trying to do, and highlited in red the line that I added.
    <pre>Sub P22()
    Dim XLApp As New Excel.Application
    'Start printing the Update sheet for the Production Assistants
    <font color=red>DoCmd.RepaintObject acForm, "frmWait"</font color=red>
    XLApp.Workbooks.Open _
    "Srvnt01SprodmgrShendersFilesProd_AstAttendance200 1SUP#022.XLS"
    XLApp.Sheets("Update").Range("E3").Value = "07/01/01"
    XLApp.Sheets("Update").PrintOut
    XLApp.ActiveWorkbook.Saved = True
    XLApp.ActiveWorkbook.Close
    XLApp.Quit
    Set XLApp = Nothing
    End Sub
    Function p22a()
    DoCmd.OpenForm "frmWait", acNormal
    Call P22
    DoCmd.Close acForm, "frmWait", acSaveNo
    End Function
    </pre>

    Thanks again for the quick response and the triggering of my gray matter. <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

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

    Re: Howto: PopUp Form (Access 97/SR1)

    As long as you got it working, that's the important thing. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Charlotte

Posting Permissions

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