Prev: Suming Data in a Calculeted Control
Next: programming
From: DrGUI on 20 Mar 2010 02:39 Try the following: Set your combobox rowsource to: SELECT qryF.FID, qryF.FName FROM qryF UNION SELECT -1, "<All>" FROM qryF ORDER BY 1 ASC; Then on the command button's onClick event: dim strWhere as string strWhere ="" if Me.cboSelectF.value > 0 then strWhere = "FID = " & Me.cboSelectF.value endif DoCmd.OpenReport "YourReportName", acViewPreview, , strWhere "cinnie" wrote: > hello > > I have a form with a combobox having Row Source: > > SELECT qryF.FID, qryF.FName FROM qryF > ORDER BY qryF.FID ASC; > > 'FID is autonumber, FName is text > > When I click a command button, a Report opens. The Report is based on > qryAtt and has FILTER: FID = Forms!frmAtt!cboSelectF. > > All of this works perfectly. Next I added <All> to the form's combobox by > changing the Row Source to: > > SELECT qryF.FID, qryF.FName FROM qryF > UNION SELECT "*", "<All>" FROM qryF > ORDER BY qryF.FID ASC; > > My problem is with how to get the Report's Filter to accept <All>. > > a) Filter: FID = Forms!frmAtt!cboSelectF > gives Error 3071 (Reserved Error) when <All> is selected. The other choices > work fine. > > b) Filter: FID Like Forms!frmAtt!cboSelectF > accepts the <All>, but for some reason it doesn't get all of the values, > just most of them. I'm not sure why. > > I'd appreciate some tips on how to write the Report's Filter. Thanks. > -- > cinnie > -- > cinnie |