Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Non Modal dialog box that halts code (Access97 on win95b)

    I have code on a button that pops up a preview report and then a msgbox that that asks if the data is ok. The msgbox though is modal and I can't scroll around my report to check if the details are ok.

    Suggestions please on how I can get around this so that the report can be inspected before saying yes or no.
    "Heading for the deep end"

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    Why even have the MsgBox in the first place?

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    Just doin' the best that I can.....That was the idea that came to me..... I need the code to pause at that point and the data visually checked and then continue or undo selected and the code continued from that point.

    I am entering jobs from timecards and the report is a summary showing hours worked per day, which the pays are done from.
    "Heading for the deep end"

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    >>Just doin' the best that I can<<
    I was not having a shot at you, all I do if I want to preview a report is just that. When you have finished with the preview, I just close the previewed report.

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    A "non-modal dialog box that halts code" seems like a contradiction to me.

    Instead, you could show a message box that asks the user to check the data; when the user clicks OK, the report is shown. The next step is called from the OnClose event of the report, fo eaxample a new message box with Yes and No buttons asking if the data are OK.

    Another way would be to create a form that looks like a dialog box; set PopUp = Yes and Modal = No, and place command buttons "Data OK" and "Data incorrect" on the form.

  6. #6
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    When the report prints to the screen, I can't see all af it, and becuse the msgbox is modal, I can't scroll the report. The code that is excuting is only half way through and is waiting on a yes/no decision as to whether the code is to continue writing to tables or is to undo what is already done due to mistakes in entering. I need the code to stop and wait but not have everything else stop as well until the msgbox is anwered.

    I realise that the message box is not the way it needs to be done but I don't know how to do it any other way and 2/3 of the report is better than none
    "Heading for the deep end"

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    Another way is to test whether the report is still in memory, in a loop. After you exit from the loop (when you have exitted from the report preview) you could thn throw up the MsgBox to ask the question to continue or not.

    DoCmd.OpenReport "reportname",...
    Loop while "reportname" still in memory
    MsgBox "Ask the question..."

  8. #8
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    OK, you've got me interested. Now how do I check to see if the report is still in memory?
    "Heading for the deep end"

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    I'm not sure if IsLoaded will do the job or not, maybe someone else can chime in here re that.

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    I have tested the following and it works, however it does not test to see if it's in design view.

    <pre>Function IsLoaded(ByVal strFormName As String) As Boolean
    ' Returns True if the specified form is open in Form view or Datasheet view.

    Const conObjStateClosed = 0
    Const conDesignView = 0

    ' If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    ' If Forms(strFormName).CurrentView <> conDesignView Then
    ' IsLoaded = True
    ' End If
    ' End If
    If SysCmd(acSysCmdGetObjectState, acReport, strFormName) <> conObjStateClosed Then
    ' If Reports(strFormName).CurrentView <> conDesignView Then
    ' IsLoaded = True
    ' End If
    IsLoaded = True
    End If

    End Function
    </pre>


  11. #11
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    It works, but the loop stops everthing else happening. Isn't there a command that lets you tell the system to check for things trying to happen outside the loop?
    "Heading for the deep end"

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

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    Put a DoEvents inside the loop.

  13. #13
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Non Modal dialog box that halts code (Access97 on win95b)

    Thanks Patt

    I knew of it, just couldn't bring it to mind.

    Thanks for all your help today, most appreciated
    "Heading for the deep end"

Posting Permissions

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