473,382 Members | 1,791 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.

Cascade Combo help!!

Hi there,

I've been desperately trying to work out Cascade Combo's for a week now, and as much as I'm trying to follow instructions and tutorials, I can't seem to make it work!

I've attached the database, and what I'm trying to do is:

1) in frmOrder, make a cascading combo - choose a Service, which will then populate the Wards applicable to that service (tblWard shows which wards come up what service)

2) if possible, in sfrmOrders, do something similar - choose a 'Type' to order, and then the 'Item'. Same thing, choosing a type will populate the avaiable items (see tblItem for descriptions).

From what I have read the second part may be a bit trickier. Some orders will have up to 20 items so it needs to be a datasheet.

Please help??
Attached Files
File Type: zip Ward Order Database TRIAL-1.zip (88.4 KB, 75 views)
Nov 21 '11 #1
4 1344
sierra7
446 Expert 256MB
joseppi
Here is the fix.
I've just spent an hour typing the changes and they have been lost.
I'll write them as separate notes
S7
Attached Files
File Type: zip Ward Order Database TRIAL-2.zip (114.9 KB, 58 views)
Nov 21 '11 #2
sierra7
446 Expert 256MB
Hi again,
The first thing I have done was to remove all the Look-ups from the table structures. This is probably not absolutely necessary but I was getting confused; when I see ServiceID I expected to see a number not the Service-name, which is confusing when you want to use the output to cascade filter.

On the main form frmOrders, I removed tblService and tblWard from the query, as the data they were contributing could be read from the comboBoxes. If tblWard had a 'telephone-number' or 'person-in-charge' which you wanted to display, then you would leave it in and include the additional fields.

The other change was to select WardID and ServiceID from tblOrder. This is very IMPORTANT because these are the bound fields that you are going to update.

Now addressing the comboBoxes. 'Service' I renamed cmbService. The RowSource selects ServiceID and Service. The BoundColum = 1. On the Format tab the ColumnCount=2 and the ColumnWidths=0,2cms. i.e the first column is invisible, so Service is displayed.

The second comboBox is now cmbWard. The RowSource selects WardID, WardName and ServiceID. Note that ServiceID is filtered by [cmbService] i.e. the bound field in cmbService.

The top part of the form now works as you requested.
S7
Nov 21 '11 #3
sierra7
446 Expert 256MB
Hi again 2,
Adressing the sub-form;
There is an issue with Access when displaying multiple records like you want to do in the subform, whether in Datasheet view or in ContinuousRecord view, when cascade filtering. If you have four records all filtered on different values, you will only see the look-up on the one which has focus.

Starting with the query for sfrmOrder, on this occasion I have left tblItem included to get the item's description to mitigate the above mentioned problem.

The first comboBox is now cmbType, has RowSource selecting TypeID and Type, BoundColumn=1, ColumnCount=2, ColumnWidthe=0;2cms. Note that the ControlSource=TypeID (I did not mention in my last post but the ControlSources for cmbService and cmbWard were ServiceID and WardID, obvious really)

The second combo is now cmbItemID, where ControlSource=ItemID, ColumnCount=3, ColumnWidths=1.3;8;0cms, ListWidth=9.5cms but Width only = 1.3cms. The RowSource selects ItemID, Item and Type, where Type is filtered by the contents of the bound field of [cmbType].
The width has been reduced to 1.3cms but will expand to 9.5cms upon selection where the different item descriptions will be available.

Note that cmbTypeID and cmbWard are re-queried upon entry,e.g.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmbItemID_Enter()
  2. Me.cmbItemID.Requery
  3. End Sub
  4.  
Also, note that an After_Update event has been added to cmbTypeID to ensure that the Type cannot be changed to leave displayed an invalid Item for that Type.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmbTypeID_AfterUpdate()
  2. Me.ItemID = 0
  3. End Sub
The final change has been to add a textBox to display the item description. This has been called txtDescription and is bound to 'Item' from the query. On the DataTab it is set so Enabled=No and Locked=Yes, so it is for display only and can only be changed via the comboBox cmbItemID.
The subform can be displayed as continuous records (not very well aligned at the moment!)or in DataSheet mode, in the latter case check that the DatasheetCaptions are completed on the Others-Tab.

I think that's it!
S7
Nov 21 '11 #4
NeoPa
32,556 Expert Mod 16PB
You may find Cascaded Form Filtering helpful. I know this doesn't fix your problem for you, but having a play may leave you in a position where you understand the fundamentals better, and so can help you fix it yourself.
Nov 21 '11 #5

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

Similar topics

2
by: christian | last post by:
Does anybody knows how to create cascade combo boxes?
2
by: Damon | last post by:
Hi, I am using VB.Net 2003 for the first time; originally a VB6 developer. I have been unable to find a datacombo so managed to find code to do it with a normal combobox instead (not sure if...
26
by: Allen Browne | last post by:
In Access 2000 and later, you can create a relation between tables where related records can be automatically set to Null rather than deleted when the primary record is deleted. I have not seen...
3
by: =?Utf-8?B?QW5keSBD?= | last post by:
Hi, Does anyone have an example code snippet from a Windows App that loads a field from a strongly typed DataSet into a Combobox? Even dissecting the DataSet via the Immediate Pane I still can't...
1
by: lawton | last post by:
Source: this is an access 2003 question My knowledge level: reading books, internet, and trial & error; no formal training I'm trying to get a running sum of what's filtered in a subform which is...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
9
by: frys | last post by:
Access 2003 Windows XP I have a form that is for tracking attendance at programs. the main form is the program information, and the sub form is the attendance information. I have 5 homes...
1
by: gdixon | last post by:
Greetings To All! I am using a Access 2003 and my programing skills are of the cut and paste variety. This means begining programming skills and on a good day perhaps middle of the road...
4
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database. The tables that pertain to this issue are tblOrg, tblState, tblCity, and tblZip. I have posted the table structure with only the pertinant fields...
6
by: yltang | last post by:
I am working on an order system. The following are the tables and forms. (A) Tables: tblOrder: OrderID (PK), CustomerID tblOrderDetail: OrderID (PK), ProductID tblProduct: ProductID (PK),...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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...

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.