Results 1 to 13 of 13
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    parameter value (Access 2002)

    I have a form which contains a combo box. Whenever I exit that form, it always asks for the parameter value (for the combo box). If I click Cancel or OK, then I can close the form and get out without any problem. I wonder if anyone has a solution to this bogus parameter value prompt.

    Thanks

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

    Re: parameter value (Access 2002)

    Can you provide some details?
    - What is the control source of the combo box?
    - What is the row source of the combo box?

  3. #3
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: parameter value (Access 2002)

    I have had same problem when running A2K format db's in Access 2002 aka AXP. There was a lengthy thread discussing this a while back but it's not currently available due to weeding out of old posts, so cannot provide link. Never did find cause for bug, but did find workaround. Instead of using DoCmd.Close to close form, use Windows PostMessage API to close form. Add this declaration to a standard code module (so it can be used for any form in db):

    Declare Function PostMessage Lib "USER32" Alias "PostMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, _
    ByVal wParam As Long, ByVal lParam As Any) As Long

    ' Windows Message (WM) Constant:
    Public Const WM_CLOSE = &H10

    In form, for a "Close" or "Exit" button, use event procedure like this example:

    Private Sub CANCEL_btn_Click()

    Dim lngResult As Long
    lngResult = PostMessage(Me.hwnd, WM_CLOSE, 0&, 0&)

    End Sub

    If you replace the PostMessage function with SendMessage API (a logical choice), you still get the bogus parameter prompt. It's likely that the VBA DoCmd.Close statement is, underneath surface, basicly using SendMessage to send a message to the active window telling it to close. For some arcane reason this causes bug. The code above works reliably to avoid this problem.

    HTH

  4. #4
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: parameter value (Access 2002)

    I did find a get-around on this problem finally. I added an extra event to the close button - on exit event

    In this on exit event, I added

    docmd.openform "FormToOpen"

    on my close button I still have these two commands:
    docmd.close
    docmd.openform "FormToOpen"

    You cannot add docmd.close to the on exit event.

    This should eliminate that stupid parameter prompt. My combo box just contains a simple SQL to extract a few records from a table, nothing special. If I run this program on Access 2000, there is no problem at all. It is only on Access 2002 (regardless of the file format, 2000 or 2003) that gives me the trouble.

    I also noticed that the Office XP SP2 fixes a few bugs as well.

    Thanks

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: parameter value (Access 2002)

    I installed Office XP SP-2 a while ago but it did not fix this particular bug. And you are correct, bug only occurs in XP, does not occur when running same db in A2K.

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

    Re: parameter value (Access 2002)

    Sorry, but I don't understand why you're using the Exit event of the close button. Do you mean the Click event? It isn't logical to use the exit event of a button to close the form, even if it will let you.

    Using DoCmd.Open to open or select another object is logical unless there is another object already open and ready to receive the focus when you close this form.
    Charlotte

  7. #7
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: parameter value (Access 2002)

    with the use of the on exit event (and the on click event), you get rid of the bogus parameter value prompt. The on exit event does NOT close the form. The on click event still does the job. On exit only opens the intended form.

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

    Re: parameter value (Access 2002)

    Does something in "FormToOpen" or its Record Source refer to the combo box? If so, opening "FormToOpen" after closing the current form would cause the parameter prompt.

  9. #9
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: parameter value (Access 2002)

    not at all. The FormToOpen is a simple main menu of the program with a few command buttons. The current form and FormToOpen have nothing in common.

    I still think that Microsoft should come up with a bug fix on this.

  10. #10
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: parameter value (Access 2002)

    Finally Microsoft has admitted that this is a bug and posted the solution:

    Please see the knowledge base from Microsoft for details.

    Click Close (X) in the upper right corner of the form window.
    Click Restore Down in the upper right corner of the form window and then click Exit. This runs the DoCmd.Close VBA code.
    Turn the Echo method off before you issue the Close statement. Then, turn the Echo on again. For example, change DoCmd.Close

    -to-

    DoCmd.Echo False
    DoCmd.Close
    DoCmd.Echo True

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

    Re: parameter value (Access 2002)

    Excuse me, but that doesn't make sense. Which close buttons are you clicking? I don't see how you could close the form and then restore it and click exit again. If you've already closed the form, why would the DoCmd.Close code run again? Are you seeing a problem when you attempt to close a form by clicking the form's Close (X) button and not when you close the form some other way? All DoCmd.Echo does is set or clear statusbar text.

    The knowledgebase is huge, so unless you post a specific article number or a link, it isn't much use to just refer people to the knowledgebase.
    Charlotte

  12. #12
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: parameter value (Access 2002)

    (Edited by HansV to provide link to MSKB article and post - see <!help=19>Help 19<!/help>)

    Hi Charlotte,

    Sorry for not pointing out the article. It is Microsoft Knowledge Base Article - 811860.

    SYMPTOMS
    When you click the Exit button that runs the DoCmd.Close Microsoft Visual Basic for Applications (VBA) code, an Enter Parameter Value dialog box may appear. This occurs when you close a form window in Access that runs with the Windows XP operating system.

    The above symptoms are directly quoted from the knowledge base aritcle 811860. MarkD in his <post#=279408>post 279408</post#> has documented this problem as well.

  13. #13
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: parameter value (Access 2002)

    Note: A little while back I also saw the MSKB article that finally acknowledged bug, I intended to post a follow-up referencing article but was unable to locate my previoous post(s) on this subject.... <img src=/S/frown.gif border=0 alt=frown width=15 height=15> I haven't tried the "solution" provided by MSKB article, because I've been using the method described in previous post (<!post=279408,279408>279408<!/post>) and haven't had any problems with bug since adapting this technique. Note also that article indicates this bug is specific to Windows XP operating system, and affects both Access 2000 & 2002 running on XP.

Posting Permissions

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