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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query By Form Issue 1

Status
Not open for further replies.

kopy

Technical User
Joined
May 30, 2002
Messages
141
Location
US
I've created a form that allows the user to put in a date range, a range is ages and a series of check boxes that are diagnoses of subject in the source table. I've created a query with the appropriate fields and are using the values of the controls on the form as slection criteria. Here's an example of the code to obtain the value of one of the checkboxes:

[forms]![frmQBF]![cbxPDDNOS].[value]

My problem is that when I open the query, I initally get no results. If I start deleting fields that use the checkboxes values the query will start displaying the appropriate results.

Any ideas of what's going on will be greatly appreciated.

Thanks, Kopy
 
What is the SQL code of your query ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
SELECT tblPreScreeningInfo.SubjectID, tblPreScreeningInfo.SubjectLastName, tblPreScreeningInfo.SubjectFirstName, tblPreScreeningInfo.HomePhone, tblPreScreeningInfo.WorkPhone, tblPreScreeningInfo.CellPhone, tblPreScreeningInfo.[BestTimeToCall/Comments], tblPreScreeningInfo.EMailAddress1, tblPreScreeningInfo.EMailAddress2, tblPreScreeningInfo.PreferredMethodContact, tblPreScreeningInfo.OtherPreferredMethodContactComments, tblPreScreeningInfo.PreferredMethodContactComments, tblPreScreeningInfo.Address1, tblPreScreeningInfo.Address2, tblPreScreeningInfo.City, tblPreScreeningInfo.State, tblPreScreeningInfo.Zip, tblPreScreeningInfo.PreScreenDate, tblPreScreeningInfo.InitialAge, tblPreScreeningInfo.CurrentAge, tblPreScreeningInfo.PDDNOS, tblPreScreeningInfo.Autism, tblPreScreeningInfo.Aspergers, tblPreScreeningInfo.HFA, tblPreScreeningInfo.ASD
FROM tblPreScreeningInfo
WHERE (((tblPreScreeningInfo.PreScreenDate) Between [forms]![frmQBF]![txtStartDate] And [forms]![frmQBF]![txtEndDate]) AND ((tblPreScreeningInfo.InitialAge) Between [forms]![frmQBF]![txtStartInitialAge] And [forms]![frmQBF]![txtEndInitialAge]) AND ((tblPreScreeningInfo.CurrentAge) Between [forms]![frmQBF]![txtStartCurrentAge] And [forms]![frmQBF]![txtEndCurrentAge]) AND ((tblPreScreeningInfo.PDDNOS)=[forms]![frmQBF]![cbxPDDNOS].[value]) AND ((tblPreScreeningInfo.Autism)=[forms]![frmQBF]![cbxAutism].[value]) AND ((tblPreScreeningInfo.Aspergers)=[forms]![frmQBF]![cbxAspergers].[value]) AND ((tblPreScreeningInfo.HFA)=[forms]![frmQBF]![cbxHFA].[value]) AND ((tblPreScreeningInfo.ASD)=[forms]![frmQBF]![cbxASD].[value]));
 
What about replacing this:
((tblPreScreeningInfo.PDDNOS)=[forms]![frmQBF]![cbxPDDNOS].[value])
with this ?
(tblPreScreeningInfo.PDDNOS=[Forms]![frmQBF]![cbxPDDNOS] OR [Forms]![frmQBF]![cbxPDDNOS] Is Null)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It seems to work!

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top