Solved

How do I use TrueFalse function in the argument where for a query

Posted on 2004-08-03
3
235 Views
Last Modified: 2012-05-05
I have a form where user can input restriction.

Like "show me date from XXXXXX(input) to XXXXXX(input) "
Then I use what's in the form to query the database (table transaction) with the where argument

In the creation view of the query, I would like to use the WHERE argument and put something like

Field : .Transaction.TransactionDate
Table : Transaction
Order : ASC
Show : No
Where : TrueFalse(Form![formname]![fromdate] Is Null;Display All;>=Form![formname]![fromdate]) AND  TrueFalse(Form![formname]![todate] Is Null;Display All;<=Form![formname]![todate])

the default value of the field on the form is Null or "" or blank, I want the query to restrict to the input only if a value has been entered.
I have a number of input restriction but I just need to know the general idea of what it's suppose to look like.

Can someone help me with that?
0
Comment
Question by:BrunoTremblay
3 Comments
 
LVL 26

Expert Comment

by:dannywareham
ID: 11707160
Enclose your query field with nz(query field)

This caputres all nulls
0
 

Author Comment

by:BrunoTremblay
ID: 11707273
and what does it do like, I'll look for it
0
 
LVL 44

Accepted Solution

by:
GRayL earned 500 total points
ID: 11707828
Field: iif((Forms!FormName!FromDate + Forms!FormName!ToDate) is Null,"",
[TransactionDate] Between Forms!FormName!FromDate and Forms!FormName!ToDate)
Table: Transaction
 Order: ASC
Show: No
Criteria: <> False

I know it looks strange but it worked with my test case. I do not know if the todate and fromdate identifiers have to be wrapped in date delimteres (#). Try it this way first and if it doesn't work we can try the delimiters.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question