Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    docmd.open form not working

    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
    Kevin

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,483
    Thanks
    3
    Thanked 41 Times in 41 Posts
    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.
    Wendell

  4. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Wendell... that was it... up and running again
    Kevin

Posting Permissions

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