Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict Data that does not meet Query Criteria 100%

Status
Not open for further replies.

iteach2

Technical User
Sep 16, 2001
120
US
Thank you all for your help, as a newbie i have done more with my DB than i ever would have without you alls-)

I have a popup form where you enter

StartDate:_________
Enddate:___________
Type:(hardware or software)
Site:WW or RR



My query looks like this:

SELECT tblChange.Type, tblChange.[ChangeCtrl#], tblChange.StartDate, tblChange.EndDate, tblChange.Status, tblChange.Site, tblChange.Description
FROM tblChange
WHERE (((tblChange.StartDate) Between [Forms]![hardsoftpopup]![txtStartDate] And [Forms]![hardsoftpopup]![txtEndDate]) AND ((tblChange.Site)=[Forms]![hardsoftpopup]![cboSite]) AND (([Forms]![hardsoftpopup]![cboType])<>False));

My execute button on popupform looks like this:

Private Sub cmdOK_Click()
If IsNull(Me!txtStartDate) Then
MsgBox &quot;Hey! Enter a Start Date.&quot;
Me!txtStartDate.SetFocus
ElseIf IsNull(Me.txtEndDate) Then
MsgBox &quot;Hey! Enter an End Date.&quot;
Me!txtEndDate.SetFocus
ElseIf IsNull(Me.cboType) Then
MsgBox &quot;Hey! Enter Type.&quot;
Me!cboType.SetFocus
ElseIf IsNull(Me.cboSite) Then
MsgBox &quot;Hey! Enter Site Name.&quot;
Me!cboType.SetFocus

Else
DoCmd.OpenReport &quot; rptHardSoft&quot;, acPreview
DoCmd.Close acForm, Me.Name
End If
End Sub

As you can see the query will check a specific date range
site name and type of update(either hardware or software).


Everything works fine,&quot;but&quot; when i do

startdate: 09/22
enddate: 09/24
Site:ww
Type: software

I get:


software 09/22 09/24

software 09/22 09/24

hardware 09/22 09/24


I don't know how to fix its-)

It look like the dates are overiding the type criteria:

is their any way i can restrict the hardware entries(when running a software query)(and vice versa) eventhough it doe fit the specified date range criteria....

I am totally all thunk out....can any help me...i'd be very gratefuls-)
 
[Forms]![hardsoftpopup]![cboType])<>False?
Both &quot;hardware&quot; and &quot;software&quot; meet your criteria, unless your combo box is somehow getting a true/false value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top