Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    173

    Unanswered: open a form - show a reminder afterit opens - not working

    I have a login form -if the login is successful I am calling a procedure named SetReminders



    if there are past due jobs, I want the Mainform to open - CallManagerDTM
    Then after that opens Iwant a message box to open telling the user about the reminders. If they want to see them, I am opening another form named

    if there are no past due jobs - i am just opening the form CallManagerDTM this works fine


    The problem is this...if there are past due jobs, I am getting the message box BEFORE theform CallManagerDTM opens..


    What i want to do is always open the form named CallManager DTM - then after that fully loads/opens/displays - show the message box to alert the user of the past due jobs.

    I tried the code on the CallManager DTM form instead of the Login form - same thing - themessagebox appears before the CallManagerDTM form opens..

    Any ideas? code is below... Thanks!


    Public Sub SetReminders()



    intStore = DCount("[JobNumber]", "[tblJobs]", "[ExpectedCompletionDate] <=Now() AND [Complete] =0")

    'If count of uncomplete jobs is zero display main form
    'Else display message box detailing amount of jobs
    'and give the user the option as to whether to view these or not.
    If intStore = 0 Then


    'open call manager form - no past due jobs - works fine!

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "CallManagerDTM"
    DoCmd.OpenForm stDocName, , , stLinkCriteria



    Exit Sub
    Else

    'open call manager form - there are due jobs I wan to open this form first

    Dim stDocNameB As String
    Dim stLinkCriteriaB As String

    stDocNameB = "CallManagerDTM"
    DoCmd.OpenForm stDocNameB, , , stLinkCriteriaB

    'then - show the message box - I want to do this AFTER the form opens - but it shows
    BEFORE - not working right!



    If MsgBox("There are " & intStore & " uncompleted jobs" & _
    vbCrLf & vbCrLf & "Would you like to see these now?", _
    vbYesNo, "You Have Uncomplete Jobs...") = vbYes Then
    DoCmd.OpenForm "frmReminders", acNormal
    Else
    Exit Sub
    End If
    End If





    End Sub

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    if you want stuff to happen only after a form is fully open, try this:

    in Form_Load()
    me.timerinterval = 1

    in Form_Timer()
    me.timerinterval = 0
    msgbox "This appears one millisecond after the form is fully open"


    if you are already using the timer for something else:

    add a formwide variable
    dim amLoading as boolean

    in Form_Load()
    amLoading = true
    me.timerinterval = 1

    in Form_Timer()
    if amLoading then
    me.timerinterval = XXX 'whatever you want the interval to be
    amLoading = false
    msgbox "This appears one millisecond after the form is fully open"
    else
    'your
    'other
    'timer
    'code
    'goes
    'here
    endif


    izy
    currently using SS 2008R2

Posting Permissions

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