473,385 Members | 1,320 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,385 software developers and data experts.

Query by Form for field by value or all values

Jim
I have a form named FindData that has a field on it named txtUID. If a
person types in an ID and clicks the search button, I want the query to
find all the records in the table MAIN that have the matching ID in a
column named "UserID"... no problem there. If they don't key in an ID
on the form, I want it to find all the records in the table MAIN that
have something entered into the "UserID" field, but omit the records
that have blank UserID fields...

I've tried dozens of alternatives in the query builder

This is what's under the UserID field in the query:

IIf([Forms]![FindData]![txtUID] Is Null,Not Is
Null,[Forms]![FindData]![txtUID])

Help.

Mar 18 '06 #1
4 1691
Jim wrote:
I have a form named FindData that has a field on it named txtUID. If a
person types in an ID and clicks the search button, I want the query to
find all the records in the table MAIN that have the matching ID in a
column named "UserID"... no problem there. If they don't key in an ID
on the form, I want it to find all the records in the table MAIN that
have something entered into the "UserID" field, but omit the records
that have blank UserID fields...

I've tried dozens of alternatives in the query builder

This is what's under the UserID field in the query:

IIf([Forms]![FindData]![txtUID] Is Null,Not Is
Null,[Forms]![FindData]![txtUID])

Help.

You could do something like this

Dim strFilter As String
strFilter = "UserID " & _
IIF(Not IsNull(txtUID)," = " & txtUID,"Is Not Null")
Me.Filter = strFilter
Me.FilterOn = True
Mar 18 '06 #2
Jim
Thanks salad... it worked!

Mar 18 '06 #3
PCD
Here's another alternative ---
Put the following expression in the criteria:
[Forms]![FindData]![txtUID] Or ([Forms]![FindData]![txtUID] Is Null)

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1150 users have come to me from the newsgroups requesting help
re******@pcdatasheet.com


"Jim" <jl*******@gmail.com> wrote in message
news:11********************@e56g2000cwe.googlegrou ps.com...
I have a form named FindData that has a field on it named txtUID. If a
person types in an ID and clicks the search button, I want the query to
find all the records in the table MAIN that have the matching ID in a
column named "UserID"... no problem there. If they don't key in an ID
on the form, I want it to find all the records in the table MAIN that
have something entered into the "UserID" field, but omit the records
that have blank UserID fields...

I've tried dozens of alternatives in the query builder

This is what's under the UserID field in the query:

IIf([Forms]![FindData]![txtUID] Is Null,Not Is
Null,[Forms]![FindData]![txtUID])

Help.

Mar 19 '06 #4

"PCD" <no***@email.com> schreef in bericht news:7a*****************@newsread2.news.atl.earthl ink.net...

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications 'Resource ????
Over 1150 users have come to me from the newsgroups requesting help '1150 users ????
re******@pcdatasheet.com



--
To Steve:
Over 525!! users from the newsgroups have visited the website to read what kind of a 'resource' you are... (rapidly increasing..)

To the original poster:

Most people here have a common belief that the newsgroups are for *free exchange of information*.
But Steve is a notorious job hunter in these groups, always trying to sell his services.

Before you intend to do business with him look at:
http://home.tiscali.nl/arracom/whoissteve.html

Arno R
Mar 19 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MX1 | last post by:
I'm ready to pull the hair out of my head. I have a query with a couple of parameters that I want to get from combo boxes on a form. One parameter is a date with a dynamically calculated year and...
2
by: Willem | last post by:
Hi there, I'm sort of new with doing much record manipulation with queries. Up till now I've been programming VBA and doing record looping to get my results. This works fine but tends to get...
2
by: neptune | last post by:
I have a query where each customer has an or . Sometimes both fields for a customer are populated, but if is null, then will be populated and vice versa. I have a form, , where I select a...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
15
by: Darren | last post by:
Help, i want to run an update query from a form.. and was wonderin.. Can the update query run if i want to update a value manually inputted from a form (e.g. !!) to a table...
7
by: Henrootje | last post by:
I have a form that gets filtered on several fields but the OKGR_ID is not one of them. OKGR_ID is a numeric field. I would like to use those values in a query Select * Where (the Groupnumber...
5
by: DeanL | last post by:
Hi all, I'm trying to set up a query that runs from a command button on a form (simple enough so far), what I want the query to do is take values from the fields on the form (seven fields in...
1
by: Coll | last post by:
I have a database that produces different "cuts" of data for the user to export into excel. The database essentially opens queries using different criteria to filter the data as the user wants it....
4
by: zion4ever | last post by:
Hello good people, Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.