Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

option group and type mismatch

Status
Not open for further replies.

aperture

Programmer
Jul 25, 2001
22
US
hello,

i have an option group with four choices. i would like assign a text value to each choice for display on a report. on the report, i've got a text box to display the text value, like so;

optnThingy= 1,2,3,4
txtThingy = Yes, No, N/A, Pending

in the report_open event, i've written a macro that evaluates the optn's value in the condition column. the action i'm using is setvalue, and there is a row or each set. i've put the textbox, not the optngrp itself, in the item field. the expression i'm using is simply, "yes," "no," etc. i still get a type mismatch.

suggestions?

thanks,

ap
 

Your putting too much effort into the report. Put the emphasis on the underlying recordsource and simply build your report from that. The following query:

SELECT tbltest.*, funOptionString([optionvalue]) AS OptString
FROM tbltest;

Notice that your text values from the option group are provided by a function taking the option group value as its argument.

Paste the below function into a module, make your query reasonably similar to the one above, and build your report based on the query.


Public Function funOptionString(intValIn As Long) As String
Select Case intValIn
Case Is = 1
funOptionString = "YES"
Case Is = 2
funOptionString = "NO"
Case Is = 3
funOptionString = "N/A"
Case Is = 4
funOptionString = "PENDING"
Case Else
funOptionString = "UNDEFINED"
End Select

End Function


Robert Berman
 
Hi!

Alternatively you can do it right in the query with nested iifs:

IIf([optnthingy]=1,"Yes",IIf([optnthingy]=2,"No",IIf(etc.

hth
Jeff Bridgham
bridgham@purdue.edu
 
thornmaster, jerby-

thanks!

both worked...im a happy ap.

john tarleton

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top