Query for specific fields

  • Thread starter Thread starter FROTO
  • Start date Start date
F

FROTO

How would I construct the following query or would it
work better through VB code? On my table I have three
fields Called Carbon, Hydrogen and Nitrogen. What Io need
to do, is to perform a search in the database for records
which have values for any or all of the above fields by a
certain date and show only those records.

Thanks
 
SELECT *
FROM YourTable
WHERE (Carbon is Not Null or
Hydrogen is Not Null or
Nitrogen is not Null)
AND TheDateField <= #1/1/03#

If you are doing this in the query grid, you will need to use three lines of criteria.
Under TheDateField put <=#1/1/03# on three lines of the criteria
Under Carbon put Is Not Null on the first line
Under Hydrogen put Is Not Null on the second line
Under Nitrogen put Is Not Null on the third line.

By the way, your table structure is probably wrong. I say that because you are
storing the names of elements in the field name. You probably would be better
off storing the element names in a field called ElementName and having multiple records.
 
Hi,

If I understand your question correctly it can be done using a query.
Example:

Field: Carbon || Hydrogen ||
Nitrogen
Criteria: "some value"
Or: "some value"
Or:
"some value"

If it's any value then:

Field: Carbon || Hydrogen ||
Nitrogen
Criteria: Is Not Null
Or: Is Not Null
Or:
Is Not Null



I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights



--------------------
| Content-Class: urn:content-classes:message
| From: "FROTO" <[email protected]>
| Sender: "FROTO" <[email protected]>
| Subject: Query for specific fields
| Date: Wed, 14 Apr 2004 09:04:50 -0700
| Lines: 9
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcQiOjdyfRAvrt2GTyy9ClZI6CoGSA==
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.queries:197367
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.queries
|
|
| How would I construct the following query or would it
| work better through VB code? On my table I have three
| fields Called Carbon, Hydrogen and Nitrogen. What Io need
| to do, is to perform a search in the database for records
| which have values for any or all of the above fields by a
| certain date and show only those records.
|
| Thanks
|
 
Back
Top