Query returns incorrect results

This is a discussion on Query returns incorrect results within the ms-access forums in Other Databases category; I have two drop down boxes, for the fields County and Category on a form which when selected for the respective County and Category will return Agency Names of Agencies within the respective County and Category. For example, when I select Cook County and Cardiovascular disease I expect the query(ies) behind the form to return Names of Agencies in Cook County that provide services regarding Cardiovascular care. However, what is returned are Names of Agencies outside of the county and category selected. What is wrong? What must I fix? Thanks, John...

Go Back   Database Forum > Other Databases > ms-access

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-26-2008, 01:31 PM
Default Query returns incorrect results

I have two drop down boxes, for the fields "County" and "Category" on
a form which when selected for the respective County and Category will
return Agency Names of Agencies within the respective County and
Category.

For example, when I select Cook County and Cardiovascular disease I
expect the query(ies) behind the form to return Names of Agencies in
Cook County that provide services regarding Cardiovascular care.

However, what is returned are Names of Agencies outside of the county
and category selected.

What is wrong? What must I fix?

Thanks,

John
Reply With Quote
  #2  
Old 08-26-2008, 01:39 PM
Default Re: Query returns incorrect results

I assume the dropdown boxes are, in fact, combobox controls not listbox
controls.
Are the properties of the combo boxes set to Limit To List = Yes?
Does your query re-execute in the After_Update event of BOTH controls?
Fred Zuckerman

"zufie" wrote in message
news:65aa3a09-0f65-42d3-b900-22b6b632d43f-at-b2g2000prf.googlegroups.com...
>I have two drop down boxes, for the fields "County" and "Category" on
> a form which when selected for the respective County and Category will
> return Agency Names of Agencies within the respective County and
> Category.
>
> For example, when I select Cook County and Cardiovascular disease I
> expect the query(ies) behind the form to return Names of Agencies in
> Cook County that provide services regarding Cardiovascular care.
>
> However, what is returned are Names of Agencies outside of the county
> and category selected.
>
> What is wrong? What must I fix?
>
> Thanks,
>
> John



Reply With Quote
  #3  
Old 08-27-2008, 02:43 PM
Default Re: Query returns incorrect results

Precise, concise questions usually get the best answers. In your case, a
precise question would have mentioned how you use the values from the combo
boxes. As it is, the answers to your questions would be:

> What is wrong?


Almost certainly, your implementation.

> What must I fix?


As you only described, vaguely, what forms, controls, and subjects, it would
be difficult to be more specific.

Would you care to clarify? On the assumption that you tell us what you
have, in detail, that is going wrong, I would make a further assumption that
someone here can offer useful suggestions.

Larry Linson
Microsoft Office Access MVP



"zufie" wrote in message
news:65aa3a09-0f65-42d3-b900-22b6b632d43f-at-b2g2000prf.googlegroups.com...
>I have two drop down boxes, for the fields "County" and "Category" on
> a form which when selected for the respective County and Category will
> return Agency Names of Agencies within the respective County and
> Category.
>
> For example, when I select Cook County and Cardiovascular disease I
> expect the query(ies) behind the form to return Names of Agencies in
> Cook County that provide services regarding Cardiovascular care.
>
> However, what is returned are Names of Agencies outside of the county
> and category selected.
>
> What is wrong? What must I fix?
>
> Thanks,
>
> John



Reply With Quote
  #4  
Old 08-28-2008, 10:57 AM
Default Re: Query returns incorrect results

On Aug 27, 12:43*pm, "Larry Linson" wrote:
> Precise, concise questions usually get the best answers. *In your case,a
> precise question would have mentioned how you use the values from the combo
> boxes. *As it is, the answers to your questions would be:
>
> *> What is wrong?
>
> Almost certainly, your implementation.
>
> *> What must I fix?
>
> As you only described, vaguely, what forms, controls, and subjects, it would
> be difficult to be more specific.
>
> Would you care to clarify? *On the assumption that you tell us what you
> have, in detail, that is going wrong, I would make a further assumption that
> someone here can offer useful suggestions.
>
> *Larry Linson
> *Microsoft Office Access MVP
>
> "zufie" wrote in message
>
> news:65aa3a09-0f65-42d3-b900-22b6b632d43f-at-b2g2000prf.googlegroups.com...
>
>
>
> >I have two drop down boxes, for the fields "County" and "Category" on
> > a form which when selected for the respective County and Category will
> > return Agency Names of Agencies within the respective County and
> > Category.

>
> > For example, when I select Cook County and Cardiovascular disease I
> > expect the query(ies) behind the form to return Names of Agencies in
> > Cook County that provide services regarding Cardiovascular care.

>
> > However, what is returned are Names of Agencies outside of the county
> > and category selected.

>
> > What is wrong? What must I fix?

>
> > Thanks,

>
> > John- Hide quoted text -

>
> - Show quoted text -




Sorry, here is my VBA code for all the controls (2 combo boxes and 1
checkbox)

John

Option Compare Database
Option Explicit
Private Sub Check13_AfterUpdate()
If Me![Check13] Then
Me![Combo3].Enabled = False
Me![Chicago Zip].Enabled = True
Else
Me![Combo3].Enabled = True
Me![Chicago Zip].Enabled = False
End If
End Sub
Private Sub ToggleLink_Click()
' Me![Combo3] County
' Me![Combo9] Category
Me.Requery
If Me.NewRecord Or (Me![Check13] And IsNull(Me![Combo3]) And IsNull(Me!
[Combo9])) Or _
(Me![Check13] And IsNull(Me![Chicago Zip]) And
IsNull(Me![Combo9])) Then
Forms![Sub: Agency Lookup].DataEntry = True
Else
If Me![Check13] Then
If IsNull(Me![Combo9]) Then
Forms![Sub: Agency Lookup].RowSource = "qry Agencies by Zip"
ElseIf IsNull(Me![Chicago Zip]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by Zip Category", , , ""
End If
Else
If IsNull(Me![Combo9]) Then
DoCmd.OpenForm "Sub: Agency Lookup by County", , , ""
ElseIf IsNull(Me![Combo3]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by County Category", , , ""
End If
End If
End If
End Sub
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 02:26 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.