• docmd.open form not working

    Author
    Topic
    #494810

    Hi,
    I am confused as to why the docmd.open form command is not working in the below code:
    Dim MsgNewProc, Style, TITLE, ResponseNEwPRoc, MyStringNewProc

    MsgNewProc = “Do you need to create a record for a NEW CONTRACT/AWARD Record?”
    Style = vbYesNo + vbCritical + vbDefaultButton2
    TITLE = “Is this a NEW CONTRACT/AWARD ?”
    ‘Help = “DEMO.HLP”
    ‘Ctxt = 1000

    ResponseNEwPRoc = MsgBox(MsgNewProc, Style, TITLE)

    If ResponseNEwPRoc = vbYes Then ‘ User chose Yes.
    MyStringNewProc = “Yes” ‘ Perform some action.

    On Error GoTo Err_Quit_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

    DoCmd.Close acForm, “PIIN -> New -> Contract”, acSaveYes
    DoCmd.Close acForm, “Procurement -> New -> Specification”, acSaveYes
    ‘DoCmd.Close Forms![PIIN -> New -> Contract].Form
    ‘DoCmd.Close Forms![Procurement -> New -> Specification].Form

    DoCmd.OpenForm “Procurement -> Update -> Order or Contract Awarded”, acNormal

    Else ‘ User chose No.
    MyStringNewProc = “No” ‘ Perform some action.

    On Error GoTo Err_Quit_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    DoCmd.Close

    End If

    When user answers yes to the question the form looks like it opens but really doesnt… the screen will actually blink like something happened but the form is not opened… I typed the following in the immediate window and get the following:

    DoCmd.OpenForm “Procurement -> Update -> Order or Contract Awarded”,,,,,acWindowNormal…

    …the form actually opens

    ? Forms(“Procurement -> Update -> Order or Contract Awarded”).Name…
    … the form is found as I get this “Procurement -> Update -> Order or Contract Awarded”

    Can anyone help me shed some light on this

    Also Database originally created in Access 97 and upgraded thru years to 2007 and all other forms open fine using this method

    thank you
    Kevin

    Viewing 1 reply thread
    Author
    Replies
    • #1453557

      My suspicion is that your error-handling code is hiding an error message that happens when the form is opened. I would disable both of the On Error GoTo Err_Quit_Click statements by putting an apostrophe at the beginning of the line so it becomes a comment, and then see what happens. A bit of a shot in the dark, but I’ve seen it happen enough times that it may well be the issue.

    • #1453706

      Thank you Wendell… that was it… up and running again

    Viewing 1 reply thread
    Reply To: docmd.open form not working

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: