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

Cascading Lists using a Query

I have looked around and can't find any thing on this.
This is what I have

Table A (Actions)
Approved
Pending
ect...

Table B (Reasons)
N/A
Denied
Waiting paperwork
Corrections
Bad Credit
ect...


I then put Table A and B in to a Query
Qur A
Field1= Field2 (both dropdowns from Table A and B using Lookup wizard)
Denied=Bad Credit
Approved= N/A
Pending= Waiting Paperwork
Pending= Corrections
Ect...

I have another Table listed as All Data
Fields inclued Date,Action,Reason,remarks, ect.. As you can see Action and Reason show up again based on Qur A. I then created a form from the tabl All Data using wizard.
I put in the fallowing code under Action After update.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Action_AfterUpdate()
  2.    On Error Resume Next
  3.    Reason.RowSource = "Select [Qur A].Reason " & _
  4.             "FROM [Qur A] " & _
  5.             "WHERE [Qur A].Action_Type = '" & Action_Type.Value & "' " & _
  6.             "ORDER BY [Qur A].Reason;"
  7. End Sub
Expand|Select|Wrap|Line Numbers
  1. Row Source: SELECT DISTINCT [qurAction Type vs Reason].[Action Type] FROM [qurAction Type vs Reason] ORDER BY [qurAction Type vs Reason].[Action Type]; 
Control Source based on All Data table= Action
But when I click on Action all I get is numbers.
Sep 17 '10 #1
12 1539
ok I took the All Data table and changed them to Look up from Table A and Table B. that got the words back.
removed and readded the up date field to the form words still there. :)

Action row source reads: SELECT [tblAction Types Choices].[ID], [tblAction Types Choices].[Action Type] FROM [tblAction Types Choices];

After update same code (just testing) Got an After update Error message.
then I changed the Code to

Expand|Select|Wrap|Line Numbers
  1. Private Sub Action_Type_AfterUpdate()
  2.    On Error Resume Next
  3.    Reason.RowSource = "Select [All Data].Reason " & _
  4.             "FROM [All Data] " & _
  5.             "WHERE [All Data].Action_Type = '" & Action_Type.Value & "' " & _
  6.             "ORDER BY [All Data].Reason;"
  7. End Sub
But get the same Error Message when I click Action on my form.
Sep 17 '10 #2
Ok no one has answers me on this yet. Y?
Sep 20 '10 #3
dsatino
393 256MB
Because this is not a customer service site. This is a collaborative site of shared knowledge where people answer if they:
1. can
2. are willing
3. have the time
Oct 6 '10 #4
I am sorry I guess that could have been read as disrespectful I didn't mean to be. Some times I run around like a chicken w/ it's head cut off I end w quick replies.
Oct 6 '10 #5
So I am guessing that no one knows how to make a Cascading Lists useing a Query
Oct 6 '10 #6
MMcCarthy
14,534 Expert Mod 8TB
Susan check out this article in the insights section on cascading combo/list boxes.

The problem here is not that we don't know the solution but rather that we don't understand the problem. If this article doesn't help solve your problem can you create a sample file with the offending form, queries and tables (sample data only) and then zip it up and attach it to your next post.

It may help clear up some of the confusion.
Oct 6 '10 #7
Yes I tried that and all I got were numbers. Maybe I should just redo it from scratch. I must have messed w/ it to the point that I have no clue what I did. :)
Oct 6 '10 #8
slenish
283 100+
SusanK

Check out this link. You might find it helpful :D

http://www.databasedev.co.uk/filter_combo_boxes.html
Oct 8 '10 #9
I get that part but here is were mine and this one diff.
My Reasons is a list all its own (I think this is called a string) as well as the Actions. The reason for this is so I can use the same reason for diff Actions ...like below

Qur 1
ID...Action......Reason
1....Pending..... Bad Credit
2....Pending.....Waiting Paperwork
3....Denied......Bad Credit
4....Approved.....N/A
5....Pending....Other
6....Pending....Corrections
7....Denied.....Waiting Paperwork

See how the Reasons are used more than 1 time as well as the Actions?
that is why I put it in a Query useing dropdown boxes.
Oct 12 '10 #10
MMcCarthy
14,534 Expert Mod 8TB
OK Susan this is getting totally confusing. I get that Table A and Table B are lookup tables. However, I don't get the following...
  • How do Table A and Table B relate to each other?
  • What is the sql code to qur 1 and/or qur A - not sure if these are the same or different queries?
  • Is tblAction Types Choices a join table?
  • What is the sql code for the qurAction Type vs Reason query assuming it is different to the above queries?

I think you can see why it's so confusing. Can you start from scratch and post the details of the relevant tables and queries. It might help to use their proper names to avoid any more confusion.
Oct 13 '10 #11
I have changed it up a bit I cleared it all and started from scratch. This is what I have now.

Table A (tblAction Type) is just a normal data table
Table B (tblReason) is just a normal data table
Table C (tblAction vs Reason)has ID (auto),Action type (dropdown), and Reason (dropdown)
C is the query (Qur A)


SQL is as follows:
SELECT [tblAction vs Reason].ID, [tblAction Type vs Reason].[Action Type], [tblAction Type vs Reason].Reason
FROM [tblAction Type vs Reason]
ORDER BY [tblAction Type vs Reason].[Action Type], [tblAction Type vs Reason].Reason;

Then I created an All Data table
ID,SSN,Action Type,Action Date, Reason, Notes

Try 1: In Table C...I have tried having the Action Type as a lookup field based off tblAction Type and the Reason as a lookup field based on [Qur A].Reason. In the form created by the wiz based off of Table C....added the After Update code in to field "Action Type"(yes I re-named is field in the form to cboAction Type.As well as the cboReason.)

After Update Code:
Private Sub cboAction_Type_AfterUpdate()
On Error Resume Next
Reason.RowSource = "Select [Qur A].Reason " & _
"FROM [Qur A] " & _
"WHERE [Qur A].Action_Type = '" & Action_Type.Value & "' " & _
"ORDER BY [Qur A].Reason;"
End Sub
Result: cboReason doesn't filter/cascad and cboReason shows all meaning it will show the same reason one than 1 time because it matches this each action type.

Try 2: In Table C...I have tried having the Action Type as a lookup field based off [Qur A] and the Reason as a lookup field based on [Qur A].Reason. In the form created by the wiz based off of Table C....added the After Update code in to field "Action Type"(yes I re-named is field in the form to cboAction Type.)

After Update Code:
Private Sub cboAction_Type_AfterUpdate()
On Error Resume Next
Reason.RowSource = "Select [Qur A].Reason " & _
"FROM [Qur A] " & _
"WHERE [Qur A].Action_Type = '" & Action_Type.Value & "' " & _
"ORDER BY [Qur A].Reason;"
End Sub
Result: cboAction Type shows all meaning it will show the same action one than 1 time because it matches this each reason. same with the cboReason.

Try 3: Same as try 2 but I added an unbound field that stored the value in the Action Type field. This is look up is based off tblAction Type and same results as well.

I think that is everything that has been done so far and every bit of data.
Oct 13 '10 #12
MMcCarthy
14,534 Expert Mod 8TB
OK try changing your code as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboAction_Type_AfterUpdate() 
  2. On Error Resume Next 
  3.  
  4.     Me!cboReason.RowSource = "Select [Qur A].Reason " & _ 
  5.         "FROM [Qur A] " & _ 
  6.         "WHERE [Qur A].Action_Type = '" & Me!cboAction_Type & "' " & _ 
  7.         "ORDER BY [Qur A].Reason;" 
  8.     Me!cboReason.Requery
  9.  
  10. End Sub
Oct 13 '10 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: visionstate | last post by:
Hi there, I am building a database that requires cascading lists on a form. I currently have (I may be adding more later) 3 combo boxes on my form - Department, Surname and Forename. The user...
1
by: jikdur | last post by:
Overview: I have a form screen where users input criteria into different text boxes to limit a contact table. This is then fed into a query that limits the list returned. The returned list is in a...
0
by: robert | last post by:
I am using the new beta 2 ajax control toolkit. When using the cascading drop-down obviously the items in the lists are generated through javascript, I would like to access these items serverside...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
1
by: Coll | last post by:
I'm working on a database that someone else created. I have a form - frm_main that is based on a query that is based on two tables. The join is such that the first table tbl_JCN has all records...
3
kcdoell
by: kcdoell | last post by:
Hello: I have been struggling with building a cascading list on a form that I created. My problem is that I am getting a "Datatype Mismatch in criteria expression" error that I can not seem to...
1
by: didihynes | last post by:
Hi Guys, I'm in desparate need of help. I am producing a database for my dissertation and have got majorly stuck. I am currently creating a form in which the user will select a student from a...
3
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment...
18
by: LosLobo | last post by:
Greetings all. I know that cascading lists are a common problem and in truth I my initial post here was to request help with my own, but then I figured out the right code. That being said, I have a...
3
by: Outback | last post by:
Hi. Windows XP + Access 2002. I have three tables. tblMakes ======= MakeKey (PK) Make tblModels
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
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.