MSGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Parenthesis and comma status

• Follow

```Can anyone figure out where the parenthesis and comma's might be wrong below?

Nights: IIf(DateDiff("d", IIf(CheckInDate < [Start Date],
[Start Date], IIf(Nz(CheckOutDate, Date()) > [End Date],
[End Date], Nz(CheckOutDate, Date()))) = 0, 1),
DateDiff("d", IIf(CheckInDate < [Start Date], [Start Date],
IIf(Nz(CheckOutDate, Date()) > [End Date], [End Date],
Nz(CheckOutDate, Date()))

--
Marsh
MVP [MS Access]

--
Rose
```
 0
Reply Utf 4/23/2007 9:02:02 PM

```Rose

When I end up with one of these, I start counting, adding 1 for each left
paren and subtracting for each right paren ... ditto for other brackets.

I do have a question about this phrase:
IIf(Nz(CheckOutDate, Date()) > [End Date],
[End Date], Nz(CheckOutDate, Date()))) = 0, 1)
which seems to have an extra "=0" in the "false" side of the IIF().

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Rose" <Rose@discussions.microsoft.com> wrote in message
news:874DDE30-B751-4FEE-A561-63AB4030743F@microsoft.com...
> Can anyone figure out where the parenthesis and comma's might be wrong
> below?
>
> Nights: IIf(DateDiff("d", IIf(CheckInDate < [Start Date],
> [Start Date], IIf(Nz(CheckOutDate, Date()) > [End Date],
> [End Date], Nz(CheckOutDate, Date()))) = 0, 1),
> DateDiff("d", IIf(CheckInDate < [Start Date], [Start Date],
> IIf(Nz(CheckOutDate, Date()) > [End Date], [End Date],
> Nz(CheckOutDate, Date()))
>
> --
> Marsh
> MVP [MS Access]
>
>
> --
> Rose

```
 0
Reply Jeff 4/23/2007 9:19:42 PM

```Thanks for your help and clever way to check the , and )
--
Rose

"Jeff Boyce" wrote:

> Rose
>
> When I end up with one of these, I start counting, adding 1 for each left
> paren and subtracting for each right paren ... ditto for other brackets.
>
> I do have a question about this phrase:
>      IIf(Nz(CheckOutDate, Date()) > [End Date],
>      [End Date], Nz(CheckOutDate, Date()))) = 0, 1)
> which seems to have an extra "=0" in the "false" side of the IIF().
>
> Regards
>
> Jeff Boyce
> Microsoft Office/Access MVP
>
> "Rose" <Rose@discussions.microsoft.com> wrote in message
> news:874DDE30-B751-4FEE-A561-63AB4030743F@microsoft.com...
> > Can anyone figure out where the parenthesis and comma's might be wrong
> > below?
> >
> > Nights: IIf(DateDiff("d", IIf(CheckInDate < [Start Date],
> > [Start Date], IIf(Nz(CheckOutDate, Date()) > [End Date],
> > [End Date], Nz(CheckOutDate, Date()))) = 0, 1),
> > DateDiff("d", IIf(CheckInDate < [Start Date], [Start Date],
> > IIf(Nz(CheckOutDate, Date()) > [End Date], [End Date],
> > Nz(CheckOutDate, Date()))
> >
> > --
> > Marsh
> > MVP [MS Access]
> >
> >
> > --
> > Rose
>
>
>
```
 0
Reply Utf 4/23/2007 11:40:02 PM

2 Replies
164 Views

(page loaded in 0.934 seconds)

 Reply: