how to reference combobox's column property from textbox on a report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freeskier
    New Member
    • Oct 2006
    • 65

    how to reference combobox's column property from textbox on a report

    hello,
    i have a form that opens for a report. the user selects criteria from combo boxes, clicks ok, the form is hidden, and that criteria is applied to the recordset of a report that opens. i would like the value of one of the combobox to appear in the report title.

    i have been trying in a text box:
    =[Forms]![frmCriteria]![cboCombo]
    and this works fine. however, i would like the value of the second column and trying this has not worked so far:
    =[Forms]![frmCriteria]![cboCombo].[Column(1)]

    what is the proper syntax?

    thanks
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Get rid of those brackets.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by freeskier
      hello,
      i have a form that opens for a report. the user selects criteria from combo boxes, clicks ok, the form is hidden, and that criteria is applied to the recordset of a report that opens. i would like the value of one of the combobox to appear in the report title.

      i have been trying in a text box:
      =[Forms]![frmCriteria]![cboCombo]
      and this works fine. however, i would like the value of the second column and trying this has not worked so far:
      =[Forms]![frmCriteria]![cboCombo].[Column(1)]

      what is the proper syntax?

      thanks
      Good news, you can actually keep 6 of the 8 brackets, just lose 7 and 8:
      [CODE=vb]=[Forms]![frmCriteria]![cboCombo].Column(1)[/CODE]

      Comment

      • freeskier
        New Member
        • Oct 2006
        • 65

        #4
        when i enter that into the textbox it is automatically changed to read

        =[Forms]![frmCriteria]![cboCombo].[Column](1)

        Originally posted by ADezii
        Good news, you can actually keep 6 of the 8 brackets, just lose 7 and 8:
        [CODE=vb]=[Forms]![frmCriteria]![cboCombo].Column(1)[/CODE]

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by freeskier
          when i enter that into the textbox it is automatically changed to read

          =[Forms]![frmCriteria]![cboCombo].[Column](1)
          When frmCriteria is Open, it will automatically be formatted to:
          [CODE=vb]=Forms!frmCrite ria!cboCombo.Co lumn(1)[/CODE]

          Comment

          • freeskier
            New Member
            • Oct 2006
            • 65

            #6
            Originally posted by ADezii
            When frmCriteria is Open, it will automatically be formatted to:
            [CODE=vb]=Forms!frmCrite ria!cboCombo.Co lumn(1)[/CODE]
            thanks so much! yet another MS Access idiosyncrasy...

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              Originally posted by freeskier
              thanks so much! yet another MS Access idiosyncrasy...
              Well.. it's not too odd an event. When a form is not open, the controls are not loaded so if you try to reference it, Access won't know what it is, hence the brackets. But if the form is loaded, then Access knows what you are trying to refer to.

              Comment

              • Ham1zan
                New Member
                • Nov 2016
                • 1

                #8
                Hello, i know that this thread has been solved, but i have a similar issue with freeskier.

                I would like to know, would the solution

                Code:
                =[Forms]![frmCriteria]![cboCombo].Column(1)
                work if i were to add it in the Criteria row of a query?

                Comment

                Working...