473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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
Aug 26 '08 #1
3 2057
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" <jo***********@illinois.govwrote in message
news:65**********************************@b2g2000p rf.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

Aug 26 '08 #2
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" <jo***********@illinois.govwrote in message
news:65**********************************@b2g2000p rf.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

Aug 27 '08 #3
On Aug 27, 12:43*pm, "Larry Linson" <boun...@localhost.notwrote:
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" <john.marru...@illinois.govwrote in message

news:65**********************************@b2g2000p rf.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
Aug 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Chris Greening | last post by:
I'm seeing a very strange problem with outer joins. The example below replicates the problem: create table data1 (dim1 integer, stat1 float); create table data2 (dim1 integer, stat2 float); ...
8
by: Bruce Dodds | last post by:
When run manually, my query appends 14 records. When run from code using CurrentProject.Connection.Execute, the same query appends 11 records. Does anyone have an explanation of why this could be...
0
by: Ahmed | last post by:
Hi, I'm an Access newbie and I'm trying to create a simple report binded to a query which is: SELECT survey.q0_sex AS Gender, Count(survey.q0_sex) AS FROM survey WHERE q0_sex<>"" GROUP BY...
2
by: Matt Michael | last post by:
I'm using ADO .NET to connect to a Microsoft Access database, and everything so far has been working in my program except one small problem. I am constructing a query string to search for certain...
4
by: seegoon | last post by:
Hi to all. I am pretty new to this stuff , so forgive me if I am asking the obvious. I am trying to extract some data from an Access database and am having some trouble. The SQL query that I am...
6
by: bill.mckinstry | last post by:
I have simple Select Query using two small tables. Table A includes Statement ID & Date. Table B includes Statement ID, Loan ID & Payment Amount. The Query selects payments and amounts from Table...
1
by: `Zidane Tribal | last post by:
it would appear that using the command 'crc("data")' from the String::CRC returns incorrect results (although, they are at least consistently incorrect). for example, this script..... ...
0
by: serhii7777 | last post by:
Hi, I have a report, which includes several subreports based on specific queries. Sometimes, one of the queries returns no result, which leaves a blank spot on a report. Is there a way to put a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.