Re: DoCmd.OpenReport - WhereCondition
- From: "ACase" <ACase@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 11 Aug 2005 11:38:42 -0700
Sorry you lost me on this one.
If the user does not enter anything into the combo boxes, then I would like
the where query to Print all records (*).
I have three combo boxes so there are 8 possible where clauses. Is there an
easier way to code this then writing an 8 tiered IF statement. Can I just
assign * to the field if it is nul?
Here is my current statement - assuming the user has entered a criteria in
each, it works.
strWhere = "[Country] = '" & Me!cmb_Country & "' and [Region] = '" &
Me!cmb_Region & "' and [ClientSector] = '" & Me!cmb_Sector & "'"
Thanks Again
AC
"fredg" wrote:
> On Thu, 11 Aug 2005 06:51:18 -0700, ACase wrote:
>
> > Perfect - Thank you.
> >
> > One additional question though, is how do I manage the Null values. If the
> > user does not select any values in the drop down.
> >
> > Thanks Again
> > AC
> >
> > "fredg" wrote:
> >
> >> On Wed, 10 Aug 2005 13:34:04 -0700, ACase wrote:
> >>
> >>> How do I employ multiple Where conditions.
> >>>
> >>> Example
> >>>
> >>> strWhereCountry = "Country = Forms![frmRptMenu]!cmb_Country"
> >>> strWhereRegion = "Region = Forms![frmRptMenu]!cmb_Region"
> >>>
> >>> DoCmd.OpenReport "rpt_New_Bus_Wins_by_Sector", PrintMode, strWhereCountry,
> >>> and strWhereRegion
> >>>
> >>> This is not working - is there a better way?
> >>>
> >>> Any help would be much appreciated.
> >>> AC
> >>
> >> Why do you need 2 separate string variables?
> >>
> >> Is the bound column of cmb_Country and cmb_Region a Text or Number
> >> datatype? Is that the same datatype as the datatype of [Country] and
> >> [Region]?
> >>
> >> If the combo bound columns and [Country] and [Region] fields are
> >> Number datatypes:
> >>
> >> Dim strWhere as String
> >>
> >> strWhere = "[Country] = " & Me!cmb_Country & " and [Region] = " &
> >> Me!cmb_Region
> >>
> >> If the combo bound columns and [Country] and [Region] fields are Text
> >> datatypes?
> >>
> >> strWhere = "[Country] = '" & Me!cmb_Country & "' and [Region] = '" &
> >> Me!cmb_Region & "'"
> >>
> >> DoCmd.OpenReport "rpt_New_Bus_Wins_by_Sector", acViewPreview, ,
> >> strWhere
> >>
> >> Note. You need to watch your comma placement.
> >> You had them incorrect in your OpenReport syntax.
> >> The strWhere clause goes in the Where clause argument, not in the
> >> filter argument position.
> >> DoCmd.OpenReport "Name", view, filter, where clause
> >> --
> >> Fred
> >> Please only reply to this newsgroup.
> >> I do not reply to personal email.
> >>
>
> It depends.
> What do you want to happen if nothing has been entered?
> Print all records? Print nothing?
> Show a message requesting an entry?
>
> You would first decide what you want to happen, then you can check for
> no combo entry by using:
> If IsNull(Me![cmb_Country]) Or IsNull(Me![cmb_Region]) Then
> Do this
> Else
> strWhere = "Etc."
> End If
>
> --
> Fred
> Please only reply to this newsgroup.
> I do not reply to personal email.
>
.
- Follow-Ups:
- Re: DoCmd.OpenReport - WhereCondition
- From: John Spencer (MVP)
- Re: DoCmd.OpenReport - WhereCondition
- References:
- DoCmd.OpenReport - WhereCondition
- From: ACase
- Re: DoCmd.OpenReport - WhereCondition
- From: fredg
- Re: DoCmd.OpenReport - WhereCondition
- From: ACase
- Re: DoCmd.OpenReport - WhereCondition
- From: fredg
- DoCmd.OpenReport - WhereCondition
- Prev by Date: Re: Line between columns
- Next by Date: Mailing Labels
- Previous by thread: Re: DoCmd.OpenReport - WhereCondition
- Next by thread: Re: DoCmd.OpenReport - WhereCondition
- Index(es):
Relevant Pages
|