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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter from option group

Status
Not open for further replies.

MrsMope

Technical User
Oct 18, 2004
125
US
Hi All,
What is the appropriate syntax to referenc the value of an option group in a query? I currently have:
Code:
Like IIf([Forms]![frmMain]![fraBusType]![value]=2,'*',[Forms]![frmMain]![fraBusType]![Value])
But that doesn't seem to work.

Thanks,
 
Remou,
Thanks for the reply, I tried without the !value, but still is not functioning correctly. Do you know how to reference an option grouP?
 
You need a few more quotes, I think. This:
SomeVar=IIf(Me.[fraBusType] = 2, "*", Me.[fraBusType])
Will work, but I think you want something like (guessing now):
strSQL= " ... " & IIf(Me.[fraBusType] = 2, "Like *", "=" & Me.[fraBusType])

If it still does not work for you, pehaps you could include a little more of your code?
 
Remou,
Thanks again for the reply, the statement I posted is the parameter within a query, I don't have an VBA code to post. I know how to reference it within code, but I am having trouble within the query itself.

Here is a snippet of the query:
Code:
SELECT CUSTNMBR, CUSTNAME, SLPRSNID, SPRSNSLN, Sum(WB_COMM_CALC) AS SumOfWB_COMM_CALC, WB_DATE_COMM_PROC, WB_NEWRENEW, WB_COMM_ID, 1 AS Company, WB_TIER_PERC, ITEMNMBR
FROM (WaubeWB_CPICH LEFT JOIN WaubeRM00101 ON WaubeWB_CPICH.CUSTNMBR = WaubeRM00101.CUSTNMBR) LEFT JOIN WaubeRM00301 ON WaubeWB_CPICH.SLPRSNID = WaubeRM00301.SLPRSNID
GROUP BY CUSTNMBR, CUSTNAME, SLPRSNID, WaubeRM00301.SPRSNSLN, WB_DATE_COMM_PROC, WB_NEWRENEW, WB_COMM_ID, 1, WB_TIER_PERC, ITEMNMBR, WB_CASH_COLL
HAVING (((SLPRSNID) Like IIf([Forms]![frmMain]![cboSalesperson]="",'*',[Forms]![frmMain]![cboSalesperson])) AND ((WB_DATE_COMM_PROC)>=[Forms]![frmMain]![cboFromDate] And (WB_DATE_COMM_PROC)<=[Forms]![frmMain]![cboToDate]) AND ((WB_NEWRENEW) Like IIf([Forms]![frmMain]![fraBusType]![value]=2,'*',[Forms]![frmMain]![fraBusType]![Value])) AND ((WB_COMM_ID) Like IIf([Forms]![frmMain]![cboICRole]="",'*',[Forms]![frmMain]![cboICRole])) AND ((WB_TIER_PERC) Like IIf([Forms]![frmMain]![fraTierPercentage]=1,'*',[Forms]![frmMain]![cboTier])))
ORDER BY CUSTNMBR, SLPRSNID, WB_DATE_COMM_PROC, WB_NEWRENEW, WB_COMM_ID;
I have an awful lot of parameters I know, but I don't know how else to do this, this query is ran in 4 different companies, creating a union query that then feeds a table for reporting.
 
I only tried this little bit:
Like IIf([Forms]![frmMain]![fraBusType]=2,'*',[Forms]![frmMain]![fraBusType])
And it worked for me. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top