473,416 Members | 1,738 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,416 software developers and data experts.

Filtering form by combo box

Greetings all,

I am attempting to make a form that will filter through several tables
that
(I believe) have refretial integrity. I am pulling data from several
tables into the form and i would like to eventually be able to filter
down through the
tables untill i can reach one unique record. I am creating a datbase
to keep track of registered accounts for a stae program. Each
account is registered into the program through a two diferent parties,
local and state wide. Accounts are unique. State wide parties are
unique. Local parties register accounts with either uniqie IDs or
aggregate Accounts under a unique ID. Each Local party may have one or
many names, which may or may not be unique for each account. Each
account registers information once a season (or more, sometimes people
resubmit becuase they want to make changes on their data). to enforce
refrential integrity, there is a multiple primary key index placed on
the accounts based on Dem_Y, Dem_S, Account, and Sub_date.
My tables look like this:

tblState;
StParty_ID (primary)
StParty_nm
....info

tblState_Local
LcParty_Id (primary)
StParty_ID (foreign key)
....info

tblLocal_Acct
LcParty_ID (foreign key)
LcParty_nm
Account (Primary key)

tblAccount_Dem_Y_S_Sub
Dem_y (multi- field index primary key)
Dem_S (multi- field index primary key)
Account (multi- field index primary key)
Sub_date (multi- field index primary key)
....unique data
The refrential integrity is working fine, i know this because there is
excellent heirarchy through tblState. i can "tree" down to the unique
data for an account perfectly. I would like to create a form, where i
can use combo boxes to navigate through the hierarchy as easy as i can
do in datasheet view of tblState. I am currently using one form with
several combo boxes which use the After update event to change the
rowsource of the next combo box that would correspond to the heirarchy
of the tables.

I can select a unique State party ID, and a label box will display the
State party's name. I have succesfully limited the rowsource of the
Local Party ID combo box so that it will only display the local IDs
that are registered through the selected State party_ID when i click
the drop down window. My problem is that i can not select one of the
Local ID's to continue my heirarchial form filtering. I can see them
in the dropdown window, but when i click on them i get an error sound
(Dong or Ding..whatever..). here is my code for changing the SQL
statement of the Rowsourse.
Private Sub cbxState_AfterUpdate()
Dim strSQL As String
strSQL = "Select LcParty_ID, StParty_Id "
strSQL = strSQL & "From tblState_Local "
strSQL = strSQL & "Where StParty_ID = " & Me!cbxState.Value
Me!cbxLocal.RowSource = strSQL
Me!cbxLocal.Requery
End Sub

I used this same format for changing the rowsource of the Accounts
combo box after updating the Local combo box.

I also used the Form wizard to select the specific fields from the
tables which would allow for the heirarchy to work ( so i think??)
Here is the record source for the form

SELECT tblState.StParty_nm, tblState_Local.StParty_ID,
tblLocal_Acct.Local_ID, tblLocal_Acct.LcParty_nm,
tblLocal_Acct.Account
FROM (tblState INNER JOIN tblState_Local ON tblState.StParty_ID =
tblState_Local.StParty_ID) INNER JOIN tblLocal_Acct ON
tblState_Local.LcParty_ID = tblLocal_Acct.LcParty_ID;
How do i get my combo boxes to work? should they be unbound? should
i be passing the combo boxes with multiple columns? any help would be
much appreciated. thank you in advance.
Nov 13 '05 #1
2 5421
I've done something similar before, and I may be a bit rusty (I don't
have that DB here, I'll have to send a code snippet tomorrow), but
it's something like this pseudo-code:

The first [I'll use cBox as a shortcut for comboBox] cBox I had was
bound, and all others, cascading down like you want, were unbound. (at
least, this is what I think I recall)

1st cBox, 2 columns, first column hidden with ID, the other column to
show data that the user selects (don't try to have the user memorize
ID values!) Mine was set with no default choice, so the user had to
pick something -- but it may not matter as long as the form requeries
the second cBox based on a default value when the form is opened. This
will also need an OnChange event to requery the 2nd cBox values when a
choice is made.

2nd cBox, unbound, also has 2 columns, with the second column having
selectable data too. This one, however, will have its RowSource
property set with a [join] query that has a WHERE clause equal to the
1st cBox's ID value.
This will need the OnChange event also to requery the 3rd cBox values
after a choice is made.

3rd cBox, unbound, again 2 columns, the second column with data...
....needs the RowSource set with a query with a WHERE clause equal to
the 2nd box... needs the OnChange event...

Do you see the 'water-fall' yet? Let me know if you need more info. or
clarification, and I'll post the code snippet tomorrow (if I can find
it, that is!) -- I'll let you know either way.

-PT

sp******@hotmail.com (Sean) wrote in message news:<2d*************************@posting.google.c om>...
Greetings all,

I am attempting to make a form that will filter through several tables
that
(I believe) have refretial integrity. I am pulling data from several
tables into the form and i would like to eventually be able to filter
down through the
tables untill i can reach one unique record. I am creating a datbase
to keep track of registered accounts for a stae program. Each
account is registered into the program through a two diferent parties,
local and state wide. Accounts are unique. State wide parties are
unique. Local parties register accounts with either uniqie IDs or
aggregate Accounts under a unique ID. Each Local party may have one or
many names, which may or may not be unique for each account. Each
account registers information once a season (or more, sometimes people
resubmit becuase they want to make changes on their data). to enforce
refrential integrity, there is a multiple primary key index placed on
the accounts based on Dem_Y, Dem_S, Account, and Sub_date.
My tables look like this:

tblState;
StParty_ID (primary)
StParty_nm
...info

tblState_Local
LcParty_Id (primary)
StParty_ID (foreign key)
...info

tblLocal_Acct
LcParty_ID (foreign key)
LcParty_nm
Account (Primary key)

tblAccount_Dem_Y_S_Sub
Dem_y (multi- field index primary key)
Dem_S (multi- field index primary key)
Account (multi- field index primary key)
Sub_date (multi- field index primary key)
...unique data
The refrential integrity is working fine, i know this because there is
excellent heirarchy through tblState. i can "tree" down to the unique
data for an account perfectly. I would like to create a form, where i
can use combo boxes to navigate through the hierarchy as easy as i can
do in datasheet view of tblState. I am currently using one form with
several combo boxes which use the After update event to change the
rowsource of the next combo box that would correspond to the heirarchy
of the tables.

I can select a unique State party ID, and a label box will display the
State party's name. I have succesfully limited the rowsource of the
Local Party ID combo box so that it will only display the local IDs
that are registered through the selected State party_ID when i click
the drop down window. My problem is that i can not select one of the
Local ID's to continue my heirarchial form filtering. I can see them
in the dropdown window, but when i click on them i get an error sound
(Dong or Ding..whatever..). here is my code for changing the SQL
statement of the Rowsourse.
Private Sub cbxState_AfterUpdate()
Dim strSQL As String
strSQL = "Select LcParty_ID, StParty_Id "
strSQL = strSQL & "From tblState_Local "
strSQL = strSQL & "Where StParty_ID = " & Me!cbxState.Value
Me!cbxLocal.RowSource = strSQL
Me!cbxLocal.Requery
End Sub

I used this same format for changing the rowsource of the Accounts
combo box after updating the Local combo box.

I also used the Form wizard to select the specific fields from the
tables which would allow for the heirarchy to work ( so i think??)
Here is the record source for the form

SELECT tblState.StParty_nm, tblState_Local.StParty_ID,
tblLocal_Acct.Local_ID, tblLocal_Acct.LcParty_nm,
tblLocal_Acct.Account
FROM (tblState INNER JOIN tblState_Local ON tblState.StParty_ID =
tblState_Local.StParty_ID) INNER JOIN tblLocal_Acct ON
tblState_Local.LcParty_ID = tblLocal_Acct.LcParty_ID;
How do i get my combo boxes to work? should they be unbound? should
i be passing the combo boxes with multiple columns? any help would be
much appreciated. thank you in advance.

Nov 13 '05 #2
Thank you for your speedy reply. I was working on it late into the day
yesterday, and i figured out a way using unbound comboboxes like you
said. Thanks again. Now i need to go figure out more about access.
you were a good help. I used pretty much the same psuedocode that you
did, except minor adjustments due to my table construction. thanks a
lot.


pt******@spsu.edu (PaulT) wrote in message news:<81************************@posting.google.co m>...
I've done something similar before, and I may be a bit rusty (I don't
have that DB here, I'll have to send a code snippet tomorrow), but
it's something like this pseudo-code:

The first [I'll use cBox as a shortcut for comboBox] cBox I had was
bound, and all others, cascading down like you want, were unbound. (at
least, this is what I think I recall)

1st cBox, 2 columns, first column hidden with ID, the other column to
show data that the user selects (don't try to have the user memorize
ID values!) Mine was set with no default choice, so the user had to
pick something -- but it may not matter as long as the form requeries
the second cBox based on a default value when the form is opened. This
will also need an OnChange event to requery the 2nd cBox values when a
choice is made.

2nd cBox, unbound, also has 2 columns, with the second column having
selectable data too. This one, however, will have its RowSource
property set with a [join] query that has a WHERE clause equal to the
1st cBox's ID value.
This will need the OnChange event also to requery the 3rd cBox values
after a choice is made.

3rd cBox, unbound, again 2 columns, the second column with data...
...needs the RowSource set with a query with a WHERE clause equal to
the 2nd box... needs the OnChange event...

Do you see the 'water-fall' yet? Let me know if you need more info. or
clarification, and I'll post the code snippet tomorrow (if I can find
it, that is!) -- I'll let you know either way.

-PT

sp******@hotmail.com (Sean) wrote in message news:<2d*************************@posting.google.c om>...
Greetings all,

I am attempting to make a form that will filter through several tables
that
(I believe) have refretial integrity. I am pulling data from several
tables into the form and i would like to eventually be able to filter
down through the
tables untill i can reach one unique record. I am creating a datbase
to keep track of registered accounts for a stae program. Each
account is registered into the program through a two diferent parties,
local and state wide. Accounts are unique. State wide parties are
unique. Local parties register accounts with either uniqie IDs or
aggregate Accounts under a unique ID. Each Local party may have one or
many names, which may or may not be unique for each account. Each
account registers information once a season (or more, sometimes people
resubmit becuase they want to make changes on their data). to enforce
refrential integrity, there is a multiple primary key index placed on
the accounts based on Dem_Y, Dem_S, Account, and Sub_date.
My tables look like this:

tblState;
StParty_ID (primary)
StParty_nm
...info

tblState_Local
LcParty_Id (primary)
StParty_ID (foreign key)
...info

tblLocal_Acct
LcParty_ID (foreign key)
LcParty_nm
Account (Primary key)

tblAccount_Dem_Y_S_Sub
Dem_y (multi- field index primary key)
Dem_S (multi- field index primary key)
Account (multi- field index primary key)
Sub_date (multi- field index primary key)
...unique data
The refrential integrity is working fine, i know this because there is
excellent heirarchy through tblState. i can "tree" down to the unique
data for an account perfectly. I would like to create a form, where i
can use combo boxes to navigate through the hierarchy as easy as i can
do in datasheet view of tblState. I am currently using one form with
several combo boxes which use the After update event to change the
rowsource of the next combo box that would correspond to the heirarchy
of the tables.

I can select a unique State party ID, and a label box will display the
State party's name. I have succesfully limited the rowsource of the
Local Party ID combo box so that it will only display the local IDs
that are registered through the selected State party_ID when i click
the drop down window. My problem is that i can not select one of the
Local ID's to continue my heirarchial form filtering. I can see them
in the dropdown window, but when i click on them i get an error sound
(Dong or Ding..whatever..). here is my code for changing the SQL
statement of the Rowsourse.
Private Sub cbxState_AfterUpdate()
Dim strSQL As String
strSQL = "Select LcParty_ID, StParty_Id "
strSQL = strSQL & "From tblState_Local "
strSQL = strSQL & "Where StParty_ID = " & Me!cbxState.Value
Me!cbxLocal.RowSource = strSQL
Me!cbxLocal.Requery
End Sub

I used this same format for changing the rowsource of the Accounts
combo box after updating the Local combo box.

I also used the Form wizard to select the specific fields from the
tables which would allow for the heirarchy to work ( so i think??)
Here is the record source for the form

SELECT tblState.StParty_nm, tblState_Local.StParty_ID,
tblLocal_Acct.Local_ID, tblLocal_Acct.LcParty_nm,
tblLocal_Acct.Account
FROM (tblState INNER JOIN tblState_Local ON tblState.StParty_ID =
tblState_Local.StParty_ID) INNER JOIN tblLocal_Acct ON
tblState_Local.LcParty_ID = tblLocal_Acct.LcParty_ID;
How do i get my combo boxes to work? should they be unbound? should
i be passing the combo boxes with multiple columns? any help would be
much appreciated. thank you in advance.

Nov 13 '05 #3

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

Similar topics

2
by: Dalan | last post by:
Okay, I have worked on this and then some, but cannot seem to crack it. So if someone can straighten my code out, or suggest a new approach, then I'm all ears. Here goes: I have two tables - one...
3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
0
by: Scott Loupin | last post by:
I've got two databases with similar data in them (WestSide and EastSide). I've set up two identical reports that is filtered by date and the client name. I'm using one form to do the filtering. ...
1
by: MLH | last post by:
I have a form (xxxxxxxxxxxxxx) with a combo-box control (yyyyyyyyyyyyyy). The rowsource property for that combo box is as follows: SELECT DISTINCTROW ., . FROM ; The SQL for qryVehicleList...
1
by: hackerslacker | last post by:
I have an ordering form that use two combo boxes to filter down the records of a Products table. This worked fine with the after_Update of the first filtering the records and creating the...
2
by: Dev1 | last post by:
All- I'm new to this forum and i've been working with acces for about 2 days now. I have a form in which I have two combo boxes and depending on what is selected on the first dropdown the second...
4
by: novoselent | last post by:
This seems like it should be an easy thing, but I think I'm missing something simple here...or I'm just going about it all wrong... Using Access 2003 I have a form that lists vehicle service...
3
by: flymo | last post by:
Hello All, I've bee trying out access 2007 and have a weird issue and would like to see if I'm issing something really basic. I have a form based on a query, I create a combo to look for records...
5
by: RHooper | last post by:
Hi, I'm new to Access, so I apologize if this question is trivial. I am trying to set-up a quick filter for users to define on a form bound to a table. I have a combo box called...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.