Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2007
    Posts
    148

    Unanswered: pass value into query from form

    In a subform, I have combo box which depend on a query of course. The query need 2 values from 2 unbound boxes in this subform. I put values into these 2 unbound box before I enter this subform.

    This is how I put in the criteria for each field in the query. The control names are: txtContractID and txtContractItem

    [forms]![FormName]![txtContractID] and [form]![FormName]![txtContractItem]

    Apparently, the query found the controls because it asked for the value for these criteria. I am looking at the value in these 2 boxes insidet the subform and just simply type in the same value when the query asked for them. As soon as I give the values to the query, I get the correct qurey.

    My question is how to make the query retrieve the value in the 2 unbound boxes.

    any help is greatly appreciated.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No, it asks because it can't find them. The syntax is different for a subform:

    Forms: Refer to Form and Subform properties and controls
    Paul

  3. #3
    Join Date
    Sep 2007
    Posts
    148
    Thanks.

    I still have problem runnig the query. Change the criteria to the following as the combo box is in the First subform. the query behind the combo box is qureying the 2 unbound box on this First subform.


    [Me]![txtContractID]

    [Me]![txtContractItem]

    any help is greatly welcomed!!!

  4. #4
    Join Date
    Sep 2007
    Posts
    148
    Paul! thank you. I got it

    [forms]![frmInvoiceNEW]![subfrmInvoiceItemPaymentNEW]![txtcontractID]


  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Glad you got it. "Me" is only valid in VBA code.
    Paul

Posting Permissions

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