If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > HELP!!! I'm confused!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-13-04, 08:33
Selphie_1234 Selphie_1234 is offline
Registered User
 
Join Date: Jul 2004
Location: Cumbria
Posts: 35
Question HELP!!! I'm confused!!!

Ok, i have a database, which i created. it only needs (and therefore only has) one table.
i want to make a query so i can search 2 fields of this one table for specific data ( ie a "search"-type-function) bu cant figure out how to do it.
anyone who can explain is welcome can have a go, but please only use small words as it is a tuesday!
Reply With Quote
  #2 (permalink)  
Old 07-13-04, 11:17
g00ber g00ber is offline
Registered User
 
Join Date: Jul 2004
Posts: 8
Umm.. next time be more specific to what you need..

I'm assuming you need an SQL statement?

Select * from Table1 where Table1.Field1 = "Field1Criteria" and Table1.Field2 = "Field2Criteria".
Reply With Quote
  #3 (permalink)  
Old 07-19-04, 01:56
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
<<
Ok, i have a database, which i created. it only needs (and therefore only has) one table.
i want to make a query so i can search 2 fields of this one table for specific data ( ie a "search"-type-function) bu cant figure out how to do it.
anyone who can explain is welcome can have a go, but please only use small words as it is a tuesday!
>>

The free downloadable sample database at www.bullschmidt.com/access uses the query by form concept so that on the invoices dialog one can optionally choose a rep, a customer, and perhaps a date range, click on a button that says "Input," and then have the invoice form open up showing all the invoices that match the criteria.

And here is how the query by form concept can work.

On the invoices dialog there are the following controls:
InvDateMin with DefaultValue of =DateSerial(Year(Date())-1,1,1)
InvDateMax with DefaultValue of =Date()
InvRepNum with DefaultValue of *
InvCustNum with DefaultValue of *

Also on the invoices dialog there is a command button called cmdInput to open the invoices form with the following code behind the OnClick property:
DoCmd.OpenForm "frmInv"

And of course there could be a button to open a report the same way:
DoCmd.OpenReport "rptInv", acViewPreview

The invoices form (frmInv) has RecordSource property of qryInv.

And the qryInv query's criteria for the InvDate field has:
Between [Forms]![frmInvDialog]![InvDateMin] And [Forms]![frmInvDialog]![InvDateMax]

And the qryInv query's criteria for the RepNum field has:
Like [Forms]![frmInvDialog]![InvRepNum]

And the qryInv query's criteria for the CustNum field has:
Like [Forms]![frmInvDialog]![CustNum]

One related point is that you probably wouldn't want to allow blanks (i.e. Nulls) in fields that are going to be used with Like in any criteria for that field. Otherwise the blanks wouldn't be shown. And to counter that you might consider creating the query's SQL statement dynamically so that the criteria on a particular field isn't used unless needed.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #4 (permalink)  
Old 07-20-04, 19:06
rguy84 rguy84 is offline
Registered User
 
Join Date: Jun 2004
Location: Seattle, WA
Posts: 601
I assume this is the same question you posted in the other part of this forum....
__________________
Ryan
My Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On