Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014
    Posts
    98

    Unanswered: Text Box Printing Combo box ID instead of text Value

    I am trying to print on report
    the value of combo box which is based on the query
    SELECT qryDept.DeptID, qryDept.Department
    FROM qryDept;
    with formula
    =[Form]![FormName]![comboboxName]
    But my problem is its printing ID of the combo box instead of text value which is name of the dept. say HR

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why are you using a combo box on a report. a combo box is a way of displaying options for a user to select... fine for a form, pointless for a report.

    there's several wasy of handling this
    1) is to use a dlookup as the datasource for the control, based on the value
    say the name of the column in you recordsource that holds the value to be looked up was mylookupdescription
    the name of the index (ID) of the row in the lookup tabel is mylookupID
    the name of the table is mylookuptable
    the name of the value in the reports recordset is mylookupvalue
    ..assuming that mylookupvalue is numeric
    Code:
    =dlookup("mylookupdescription", "mylookuptable", "mylookupid = " & mylookupvalue)
    ..assuming that mylookupvalue is string
    Code:
    =dlookup("mylookupdescription", "mylookuptable", "mylookupid = '" & mylookupvalue & "'")
    2) is to do a join in the underlying query to bring the required value you require intot he reports recordsource. if you have already defined realtionships, if you haven't why not? ,then add the lookup table to your query and pull the description column from the lookuptable

    of the 2 option 2 is probably the preferable
    ..actually there's many more ways of doing this than 2, but these 2 are probably the best option for you
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Your combobox BOUND COLUMN is set to the iD column#. (usu. 1)
    Change it to the column# that has the [dept]

Posting Permissions

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