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

Dependent Combo Boxes in Continuous Form

Hi,

I am trying to come up with a solution to the following scenario:

I have a continuous form on which two of the fields are "Transaction Type" and "Sub Transaction Type". When the user selects a Transaction Type, I dynamically change the contents of the sub type next to it and it works beautifully. The problem arises when I come back to view the form later. Access doesn't seem to be able to populate the second dropdown in my scenario. It would have to set the recordsource of that one on the fly and could conceivably be different for each row. Instead, it only populates with the intial row source, causing any sub types that are not part of that to show up as blank.

Does anyone have a solution or workaround to this issue? I would imagine this is a very common type of layout.

Thanks,

H
Oct 17 '07 #1
3 3802
Updated to add: I did some more digging around and found the solution where you overlay a textbox over the combo box. It seems to work ok. I'm still interested to know if there is a better way to accomplish this though.
Oct 17 '07 #2
Jim Doherty
897 Expert 512MB
Hi,

I am trying to come up with a solution to the following scenario:

I have a continuous form on which two of the fields are "Transaction Type" and "Sub Transaction Type". When the user selects a Transaction Type, I dynamically change the contents of the sub type next to it and it works beautifully. The problem arises when I come back to view the form later. Access doesn't seem to be able to populate the second dropdown in my scenario. It would have to set the recordsource of that one on the fly and could conceivably be different for each row. Instead, it only populates with the intial row source, causing any sub types that are not part of that to show up as blank.

Does anyone have a solution or workaround to this issue? I would imagine this is a very common type of layout.

Thanks,

H
Yes it is... you simply set the rowsource of the second dropdown (sub type) to the field in the table (whatever table that is) that you require to see in other words without any restrictive criteria as the default rowsource. (in other words actually typed into the rowsource by default not set at runtime by reference to any other control if you get me)

ie it needs to be this: Row Source = "Select MyField From MyTable;"

The dropdown should then correctly display the value it holds provided you should have a one column count outputting in the sub type dropdown.

The dynamic alteration you speak about in setting its rowsource on the fly should occur when the second sub type control receives the focus where you then are altering its rowsource in code to display only values in a list commensurate with values that match the transaction type selected from the first dropdown.

You should have something like this in the On_GotFocus event of the sub type dropdown

Expand|Select|Wrap|Line Numbers
  1. If IsNull(Me!TransactionTypeDropdownName) then
  2. Me!TransactionTypeDropdownName.setfocus
  3. exit sub
  4. end if
  5. 'the above end if block merely prevents the cursor entering the sub type field
  6. ' and places the cursor instead in the transaction type so in other words
  7. 'the user cannot advance and must select a transaction type before sub 'type
  8.  
  9. Me!SubType.RowSource = "Select MyField From My Table Where TransactionType='" & Forms!YourFormName!YourTransactionTypeDropdownName & "'"
Hope this helps

Regards

Jim
Oct 17 '07 #3
Thanks Jim. I will try this out.
Oct 17 '07 #4

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

Similar topics

3
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where...
1
by: me | last post by:
I would like to put 4 combo boxes on a user form, each one limiting the results to the set from the previous combo box. Can anyone please offer some guidance ? Thanks ! Please answer here in...
2
by: jim | last post by:
I have created a Table that has 13 fields and 2 Primary Keys, e.g. 60 1, 60 2, ... 60 28, 61 1, 61 2, ... 61 28, etc... I want to create a Form where I can input the Primary Key values to query...
4
by: deanndra | last post by:
First, I want to say thank you to Scott and the others who replied to my first post here. I had to put that database on hold for the moment when I was tasked with a new one. I am building another...
3
by: buddyr | last post by:
Hello, I have a store database already set up with alot of data in it. I have one table: table1 fields: partNumber, storeName,date,amount,description- ( some others) I have one form: form1 up to...
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
10
by: BeaBea | last post by:
Hi All, I have been reading some of the threads in your forum and decided to join and post my question. Hopefully it won't be too lengthy. I have created an Unbound Form called paramform2. ...
1
by: bkholloway | last post by:
hello...first time here...have an access 07 db and need to have multiple dependent combo boxes. I have a little experience using expression builder but not VBA...basically need to limit choices in...
0
by: sarvmardan | last post by:
how to open a report in access containing filtered data using two combo boxes on form and a button to click. let i have two fields and other is . two comboboxes are combo11 and combo9. plz post...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.