default value

Beaurou

New member
Local time
Today, 10:08
Joined
Jan 3, 2017
Messages
8
Hi,

This line work perfectly when I copy into the default value of [para2]

it will increment the value by one

=DCount("[Para2]","OTR Para2","[Para1]=1")+1

Now I want to combine the 3 following one into one.

=DCount("[Para2]","OTR Para2","[Para1]=1")+1
=DCount("[Para2]","OTR Para2","[Para1]=2")+1
=DCount("[Para2]","OTR Para2","[Para1]=3")+1

I have try with the iif statement with no chance

=IIf([Para1]=1,DCount("[Para2]","OTR Para2","[Para1]=1")+1,IIf([Para1]=2,DCount("[Para2]","OTR Para2","[Para1]=2")+1,IIf([Para1]=3,DCount("[para2]","OTR PARA2","[para1]=3”)+1)))

can you help
 
Its not at all clear what the point of this actually is.
Incrementing a value from a DLookup statement by 1 is perfectly sensible
However incrementing a DCount value by 1 seems a very odd thing to do.

Having said all that, you could try
Code:
=DCount("Para2","[OTR Para2]","Para1 Between 1 And 3")+1

NOTE: Always use [ ] around field & table names with spaces, otherwise these are optional
 
Found my solution

=IIf([text17]=1,DCount("[Para2]","OTR Para2","[para1]=1")+1,IIf([text17]=2,DCount("[Para2]","OTR Para2","[para1]=2")+1,IIf([text17]=3,DCount("[Para2]","OTR Para2","[para1]=3")+1,"12")))
 
you can make it much simpler:

=IIF(Nz([Text17],4)<4, DCount("Para2", "[OTR Para2]", "[para1]=" & [Text17])+1, "12")
 

Users who are viewing this thread

Back
Top Bottom