Field Expression

Hmm I didn have one more question. If the code is essentially telling the report which field list values to display, how does it know how to format the form? How does it know where to place each of the boxes? Was just kind of curious.
 
The report should already have things formatted and with fields available that the items go into. The code we have doesn't modify the report itself in any way. It just modifies which records (and which extra field it is pulling). You can have a bogus field in your initial query that is named CustomField and then you can modify the code I gave you to include that:

Code:
strSQL = "Select Product, Customer, " & Me.VariableBox & [B][COLOR=red]" As CustomField" &[/COLOR][/B] _
" FROM [Basic Program Info]" & _
" ORDER BY Product"

That way it will slide right into the field you have reserved for it on the report. Sorry, I had forgotten that little detail.
headinhands.jpg
 
Awesome, it works!

Thanks a lot for all of our help I really appreciate it. I've been trying to figure out how to do that for the past month. Well done.
 
I did find a couple of kinks though, one of them being that if i select a field value with more then 1 word it comes up with the error

Syntax error (missing operator) in query expression 'Total Displacement'
 
I did find a couple of kinks though, one of them being that if i select a field value with more then 1 word it comes up with the error

Syntax error (missing operator) in query expression 'Total Displacement'

That's why I asked if there were spaces. We need square brackets added to take care of that. Like this:

Code:
strSQL = "Select Product, Customer, [COLOR=red][B][[/B][/COLOR]" & Me.VariableBox &[COLOR=black] "[COLOR=red][B]][/B][/COLOR] As[/COLOR][COLOR=black]CustomField" &[/COLOR] _
" FROM [Basic Program Info]" & _
" ORDER BY Product"
 
Good deal, works perfect now. I tried to add to your rep as a thank you, but I already did so on a previous post so it wont let me do it again. Thanks again tho
 

Users who are viewing this thread

Back
Top Bottom