queries and criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table that has 5 fields labeled "Contact Date 1, Contact Date 2,
Contact Date 3, etc." I need to be able to pull either one date, or a range
of dates from each of the Contact Date fields. For example, I currently need
to pull all records that have yesterday's date and I know that 2 of the
contact date fields have that date in them, how do I format the criteria so I
can pull all the records for that date?
 
You need to redesign your tables; they are not normalized. You need
something like:
TblCustomer
CustomerID
etc

TblContact
ContactID
CustomerID
ContactDate
etc
 
If you can't redesign your table structure (you should), then you would need to
put the criteria on separate lines of the query grid criteria. Something like:

Field: Contact Date 1
Criteria (line 1): #1/1/2005#

Field: Contact Date 2
Criteria (line 1): <Leave blank>
Criteria (line 2): #1/1/2005#

Field: Contact Date 3
Criteria (line 1): <Leave blank>
Criteria (line 2): <Leave blank>
Criteria (line 3): #1/1/2005#

If you are doing this in the SQL statement then use the OR conjunction between
the criteria vice AND. Something like:

WHERE [Contact Date 1] = #1/1/2005# OR [Contact Date 2] = #1/1/2005# OR [Contact
Date 3] = #1/1/2005#
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Query to select individual records 4
Criteria help 4
Date/Time Selection problem!!!!! 10
Use a function in the "Criteria" of a query? 3
Select Query on Current Date 3
Date Range 3
criteria on form 1
Criteria in Query 2

Back
Top