473,396 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Select All if Textbox Empty

Hello,

I have a form with text/combo boxes that draws from a query and sends records to a report.

The query has the following code in the criteria block of some of the columns:
[Forms]![frmName]![fldName]

This code tells the query to select only those records that match what was entered or selected in the pertinent text/combo box in the "report" form. So the SQL appears as follows:
SELECT tbl.fld1, tbl1.fld2, tbl1.fld3, tbl1.fld4
FROM tbl1
WHERE (((tbl1.fld1)=[Forms]![frmName]![fld1]) AND ((tbl1.fld2)=[Forms]![frmName]![fld2]))

So when I hit the report button. Only those records matching the search criteria set in the form appear in the report.

Sometimes I want to search by fld1 & fld2, and sometimes I want to search only by fld1 or only by fld2. Thus I leave the other tbo/cbo blank.

The problem with that is Access responds to the empty cbo/tbo as "Select all where fld is empty" rather than how I want it to - "Select All since cbo/tbo is empty".

Is there an if (or other) statement I can write into the query to tell it that if it comes across an empty tbo/cbo, "Select All" in that column?
Dec 3 '07 #1
1 3031
Rabbit
12,516 Expert Mod 8TB
Use the Like operator. Don't forget the wildcards. And if you want the Nulls, don't forget to Nz() the field first.
Dec 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Tetet B via .NET 247 | last post by:
I'm using VB.Net and trying to retrieve the data in the textboxcell of a datagrid after a successful display (used Databind).User can either display data or enter data in the textbox. I canalways get...
5
by: Yuelin | last post by:
Hi there What's the best way of checking whether a textbox is empty? Thanks. Yuelin
1
by: Azmarae | last post by:
Hi, I've got an html Select box on the client side for which I add the Options/items on the client side. The options are created dynamically through textbox and button controls on the same page....
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a question about a script I'm trying to code and invoke when a button (btnSave) is pressed on the page. This script should only run when a textbox (txtAD) on the...
1
by: Fred | last post by:
I'm working with VB.NET and ASP.NET 2.0. I've set up a Gridview. I want to select on an integer field, lets say Invoice Number. I've added a text control and Submit button to the page, and...
3
by: Phillip Vong | last post by:
I'm new and trying to learn. This is in VB.NET 2. I have a simple page with one Textbox1, one Label1 and one Button1. The on_click Button one goes and get's a simple data from the SQL db with...
1
by: Brad Pears | last post by:
I am using vb.net 2005 and SQL server 2000. In my table I have a date field of type "smalldatetime". In my vb application, the user may or may not enter a date value into the appropriate text box....
3
by: 6afraidbecause789 | last post by:
If able, can someone please help make a Where clause that strings together IDs in a multi-select listbox AND includes a date range. I wasn’t thinking when I used the code below that strings...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.