Hello,
I have an issue I am trying to resolve, and I am not having much luck.
First a little history...I use text boxes in Access forms to feed criteria in Access queries. For example, the form might ask the user to enter a date then click a command button, which runs a macro that runs several queries. Many or all of those queries (each set up to pull from a different source table) use the same date for it's criteria. This saves a lot of time in opening each query in design view, changing the date, then running it. This process has been primarily used for running periodic reports. Now, we are branching out in to building more interactive tools that our users can use.
Now the issue... My problem occurs when there are multiple criteria options on the form for the user (for example: date, group_name and group_number). I would like for the user to be able to enter only the date if they wish to pull all group_names and group_numbers for that date, or only group_name for all information pertaining to that group_name, etc. Well, if only one item is entered the query returns nothing. I believe the query is picking up the blank text boxes as NULL fields because I entered the following in the criteria field:
IIf(IsNull([Form]![group_name]),"Hello",[Form]![group_name])
This returned the group_name Hello data when the text box was left blank, so obviously it is reading the text box as NULL. I can't figure out what to put in the second part of the iif statement to make it return everything. I tried Is Not Null and in the number field, it doesn't work to use >=100.
I have also played with setting the default value in the form to >=100 or Like"*", but that didn't work either. In fact, that didn't work with entering even a valid number.
Any help will be GREATLY, GREATLY appreciated!!!
I have an issue I am trying to resolve, and I am not having much luck.
First a little history...I use text boxes in Access forms to feed criteria in Access queries. For example, the form might ask the user to enter a date then click a command button, which runs a macro that runs several queries. Many or all of those queries (each set up to pull from a different source table) use the same date for it's criteria. This saves a lot of time in opening each query in design view, changing the date, then running it. This process has been primarily used for running periodic reports. Now, we are branching out in to building more interactive tools that our users can use.
Now the issue... My problem occurs when there are multiple criteria options on the form for the user (for example: date, group_name and group_number). I would like for the user to be able to enter only the date if they wish to pull all group_names and group_numbers for that date, or only group_name for all information pertaining to that group_name, etc. Well, if only one item is entered the query returns nothing. I believe the query is picking up the blank text boxes as NULL fields because I entered the following in the criteria field:
IIf(IsNull([Form]![group_name]),"Hello",[Form]![group_name])
This returned the group_name Hello data when the text box was left blank, so obviously it is reading the text box as NULL. I can't figure out what to put in the second part of the iif statement to make it return everything. I tried Is Not Null and in the number field, it doesn't work to use >=100.
I have also played with setting the default value in the form to >=100 or Like"*", but that didn't work either. In fact, that didn't work with entering even a valid number.
Any help will be GREATLY, GREATLY appreciated!!!