473,625 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1696
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******@pcdata sheet.com


"Jim" <jl*******@gmai l.com> wrote in message
news:11******** ************@e5 6g2000cwe.googl egroups.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.co m> schreef in bericht news:7a******** *********@newsr ead2.news.atl.e arthlink.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******@pcdata sheet.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
7544
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 the other is criteria for a Yes or No field. I'll focus on the Yes/No field for simplicity. If I run the query with the criteria hard coded as either "YES" or "NO", it works. In the values of the combo box in my form, I have it set as...
2
2536
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 very, very slow as the number of records grows - somewhere in the number of 5,000,000. I imagine queries are much faster but am not quite sure if queries will do the trick. My problem:
2
2912
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 value for from a combo box. In my query I set the criteria for to ... My query finds the proper values for . Now I also want to find the values if I select a value for in a separate combo box. In both controls, OnChange, I set the value of
6
29931
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 newsgroups, the access support centre, I can seem to find no similar situation. I am not using any references, or VBA at all in the first place. I am trying to set up a simple (or so I thought) query to work with the text of two tables. ...
1
2908
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 2000. The access file is in access 2000 format. I have a form that will hold the relevent parameters for the query/report that reports the statistics for all job records that match a certain criteria. These are: - A Customer Name.
15
3292
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 (tblPasswordMgmt.Password) but based on a criteria which is neither the two values. Instead it's like (!!=tblPasswordMgmt.UserID).
7
1482
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 equals one of the values mentioned on the form in the field OKGR_ID) Any suggestions as to how I can do this?
5
2067
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 total) but sometimes not all the fields will be filled. If a field is empty then the assumption is that no filter will be applied to that field in the query and should return all results within the limits of the other field in the query.
1
1426
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. The user can then print or export to excel depending on the need. So I have a form that allows the user to specify how the data should be cut. I'm stumped on one aspect of this. I have a field called "Category" that has 10 possible values. None...
4
4572
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 reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.