Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

passing to criteria to a query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Question Boy - 24 Apr 2008 18:36 GMT
I have a query in which I set the criteria of a field to the value of a combo
box on my form.

On the form, the combo box has three values
A
B
A Or B

When the 1st 2 are used the query run properly.  However the third does not
(return nothing, although individually they do).  What must I change so that
it will accept multiple criteria?

QB
Jeff Boyce - 24 Apr 2008 18:47 GMT
Please post the SQL statement of your query.

Regards

Jeff Boyce
Microsoft Office/Access MVP

>I have a query in which I set the criteria of a field to the value of a
>combo
[quoted text clipped - 12 lines]
>
> QB
Question Boy - 24 Apr 2008 18:58 GMT
SELECT Count([dtApproR]) AS [on time]
FROM ([tbl_Plan] INNER JOIN [qry_last approved] ON [tbl_Plan].PlanifIngId =
[qry_Approved].PlanifIngId) INNER JOIN [PARAMETRE] ON [tbl_Plan].ProNo =
[PARAMETRE].[Number]
WHERE ((([tbl_Plan].dtApproR)=[DateApproP]) AND ((IIf([Type
A]=True,"A",IIf([Type B]=True,"B","C"))) Like [Forms]![frm_rpt_Stats Appro et
Fab]![Combo0]));

> Please post the SQL statement of your query.
>
[quoted text clipped - 19 lines]
> >
> > QB
Douglas J. Steele - 24 Apr 2008 19:05 GMT
Try

SELECT Count([dtApproR]) AS [on time]
FROM ([tbl_Plan] INNER JOIN [qry_last approved] ON [tbl_Plan].PlanifIngId =
[qry_Approved].PlanifIngId) INNER JOIN [PARAMETRE] ON [tbl_Plan].ProNo =
[PARAMETRE].[Number]
WHERE [tbl_Plan].dtApproR=[DateApproP]
AND (([Type A]=True AND [Forms]![frm_rpt_Stats Appro et Fab]![Combo0] IN
("A", "A or B"))
OR ([Type B=True AND [Forms]![frm_rpt_Stats Appro et Fab]![Combo0] IN ("B,
"A or B")))

BTW, the fact that you've got fields named Type A and Type B is usually
indicative of the fact that you haven't correctly normalized your tables.
Check some of the resources Jeff Conrad has at
http://www.accessmvp.com/JConrad/accessjunkie/resources.html#DatabaseDesign101
to learn how to correct your design.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> SELECT Count([dtApproR]) AS [on time]
> FROM ([tbl_Plan] INNER JOIN [qry_last approved] ON [tbl_Plan].PlanifIngId
[quoted text clipped - 29 lines]
>> >
>> > QB
Question Boy - 24 Apr 2008 19:44 GMT
Ya I know.  I took over someone else's work and the boss doesn't want me to
spend time fixing such issues.  It works, don't touch....

Isn't the first time it creates problems for me.  I spent more time working
around it then solving it.

> Try
>
[quoted text clipped - 47 lines]
> >> >
> >> > QB
Klatuu - 24 Apr 2008 18:49 GMT
Post the SQL of the query, please.
Signature

Dave Hargis, Microsoft Access MVP

> I have a query in which I set the criteria of a field to the value of a combo
> box on my form.
[quoted text clipped - 9 lines]
>
> QB
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.