Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Walnut Cove, NC

    Unanswered: Listbox/Query problem

    I have a listbox on the main menu form and the record source for the listbox is a query. I also have a textbox on the main menu form where the user can type in a part number and click on a search button. The search button has this line in it:


    and it finds the part number with the query. IN the query, the criteria is:
    [forms]![deviation_main_menu]![part_Base_Dev_No] which in the name of the textbox on the main menu.

    All of this works fine while you are in the form. I have an Exit Button that closes the main menu form. When I click on the Exit button, I get a box:

    Enter Parameter Value:
    okay button and cancel button.

    This is the code for the EXIT button:

    Private Sub EXIT_Click()

    GetPartNo.EmailPartNo = 0
    DoCmd.Close acQuery, "list_query"
    DoCmd.Close acQuery, "query3"
    DoCmd.Close acForm, "deviation_main_menu"

    How can I stop the Parameter value box from popping up? I don't know what is causing it to pop up when the Exit button is pressed.



  2. #2
    Join Date
    Dec 2004
    Madison, WI

    Parameter problem

    What does:
    GetPartNo.EmailPartNo = 0 do?

    Also, are you sure there's no criteria in your queries based on a form which isn't open (maybe a subform)? - just a thought.

    Also, check your queries to make sure nothings changed with the field names and you have something like: Exp1: XXXXX.

    Also, Do you have anything happening on the On_Close event of the form deviation_main_menu your closing?

    Just some thoughts.

  3. #3
    Join Date
    Jan 2005

    vba rowsource

    why not try setting the list box's rowsource with vba rather than you paramiter query. you could have a simple query be the list box's default rowsource ie. SELECT partnumber, part FROM tablename;. then on the text box's on after update event add set the row source to a new query, using the text box's value.
    this code should work:

    Private Sub TextBox_AfterUpdate()
    Dim strSQL As String
    strSQL = "SELECT partnumber,part FROM tablename WHERE partnumber" & _
    "= '" & TextBox & "' ;"

    With ListBox
    .RowSource = strSQL
    End With

    End Sub

  4. #4
    Join Date
    Jan 2004
    Walnut Cove, NC
    Thanks for your ideas. I finally found the problem. I have a form that I open when the application loads called Main Form. I maximize it to hide the tables, queries, modules, etc. For some reason when I would leave that form open and open the Deviation form, if a search was performed and the query was accessed, the Exit procedure would cause the parameter value pop up. What I ended up doing was closing the main form when I open the Deviation form and then open the main form back up when exiting the Deviation form. It also seem to matter which event I maximized the forms in. I don't understand it, but I'm glad it's fixed.



Posting Permissions

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