Rich
Rich

Reputation: 111

Access: Search box for Greater than Less than

Is there a way to setup a query parameter to take a user input from a form to find a number that is greater than one number and less than another but still have it be okay to be blank if the user doesn't enter anything?

I tried Like "*" & Between [Forms]![DeptControl]![FastTime] And [Forms]![DeptControl]![SlowTime] & "*"

But that kicked out as an error and it won't let me do it that way.

Upvotes: 0

Views: 339

Answers (2)

Darren Bartrup-Cook
Darren Bartrup-Cook

Reputation: 19737

You could use NZ: NZ([Forms]![DeptControl]![FastTime],NOW()) - if left NULL it will use the current time.

Upvotes: 0

HansUp
HansUp

Reputation: 97101

You can't combine Like and Between into one condition like that.

It sounds like you just want to check whether some number is between [FastTime] and [SlowTime]. If so, leave Like out of it:

[Your Number] Between [Forms]![DeptControl]![FastTime] And [Forms]![DeptControl]![SlowTime]

And if you want to return all rows when either [FastTime] or [SlowTime] is Null, add those conditions with OR:

[Your Number] Between [Forms]![DeptControl]![FastTime] And [Forms]![DeptControl]![SlowTime]
OR [Forms]![DeptControl]![FastTime] Is Null OR [Forms]![DeptControl]![SlowTime] Is Null

Upvotes: 1

Related Questions