Displaying report filter criteria on report header

ekta

Registered User.
Local time
Yesterday, 19:45
Joined
Sep 6, 2002
Messages
160
Hi:

I am using a form to pass criteria in my query and my report is then based on this query.
My form has a combobox with values:
Criteria 1
Criteria 2
Criteria 3

I want that whatever criteria the user selects should be displayed on the report header.

I created a text box on my report header and added
=Form!formName!comboboxname

But this does not work. It displays the above as it is in the text box.

Thanks,
Ekta
 
I think the code should be like this
[Forms]![formName]![comboboxname] .

But if your combobox consist of multi columns then you may have specified which columns to use i.e [comboboxname].column(n) where n is the numeric 0,1,2,3...... 0 mean first column.

Another issue might lies with the number of selected criteria in the combobox. If you select multiple criteria you might want to use some coding to list the out the selected elements.

Dim Texst as string
ctl as control

ctl = comboboxname
Texst="Based Field Name ="
For Each varElement In ctl.ItemsSelected
Texst = Texst & "'" & ctl.ItemData(varElement) & "'"
Next varElement

Forms!fromname!TextBoxname = Texst

This will append all the selected items to one string.

hope this help

mderby
 
Thanx for your reply mderby.

I did put this in brackets, [Forms]![formName]![comboboxname],
but access removes it..I don't know why?

My combobox does not have multiple columns n nor am I using multiple criteria.

Ekta
 
Hi Ekta,

After some testing , I find that to display the selected value of the combobox you need to assign it in the Report's TextBox's Control Source property.

In the TextBox Control Source property it should look like this
=[Forms]![Form1]![Com]

If you more descriptive wording you may append some words in front of it.


Hope it helps.
 
mderby!!! After search over and over and over again for weeks, I finally found this post from almost 10 years ago and it worked for me!! Thank you so much!! :D
 

Users who are viewing this thread

Back
Top Bottom