473,508 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cascading combo boxes - help with syntax

56 New Member
I'd like to start off with an apology - I posted a question on a similar matter sometime ago and didn't respond to those who took the time to answer my question. At the time i gave up but have used the responses I got to revisit this now - thanks to those who reposnded originally. I'm nearly there but need help with some syntax (I think).

I am filtering the option in one combo box cboStatus based on the entry to another combo box cboLocalityTeam. cboStatus uses lookup list tlkpStatus with StatusCode (PK), StatusDesc and LocalityCode (FK) while cboLocalityTeam uses lookup tlkpLocality with Localitycode (PK) and LocalityDesc.

I've done the filter with a query qryServiceLookup:
Expand|Select|Wrap|Line Numbers
  1. SELECT tlkpStatus.StatusCode, tlkpStatus.ServiceDesc, tlkpStatus.LocalityCode
  2. FROM tlkpStatus
  3. WHERE (((tlkpStatus.LocalityCode)=[Forms]![frmSub]![cboLocalityTeam]));
It is requeried to reflect any change to the record with a macro.

frmSub is a subform that sits within frmMain; the above works fine when I open frmSub directly but when I open it within frmMain I get an "'Enter Paramaeter Value' = [Forms]![frmSub]![cboLocalityTeam" error. I assume [Forms]![frmSub]![cboLocalityTeam needs to be changed to reflect that frmSub is a subform within frmMain but I'm not sure and haven't managed to change it successfully. Appreciate any guidance!!
Sep 23 '09 #1
3 2112
NeoPa
32,557 Recognized Expert Moderator MVP
I'm not sure exactly where you're getting hung up, but these may help point you in the right direction (Referring to Items on a Sub-Form & Cascading Combo/List Boxes).

I wouldn't do the filtering in the SQL as you do, but if you are to, you need to get the reference correct. Remember (after reading the linked article) that a subform control is not the same as the form that it contains.
Sep 23 '09 #2
luciegiles
56 New Member
Thanks NeoPa - I just needed help with the syntax and the first article you mention helped with that - it is now working.

Why not filter in the SQL? I tried working through the same problem with your Cascading Combo/List Boxes article but couldn't get it to work.
Sep 29 '09 #3
NeoPa
32,557 Recognized Expert Moderator MVP
The filter is something that needs changing most frequently. The rest of the query is the fundamental design. If you include the filtering within the query then when you need to change it you will have to revisit the whole query's SQL. Separate it out however, and you can leave the worry about the complications of the whole query to the original design. The main query can be stored simply as a QueryDef and only the Filter part need be designed directly in a string in your code.

As far as putting references within SQL to form controls goes, I try to avoid that as that makes the form being open already a dependency for the query to work. When you are building the SQL in your code there is no need to use a reference when you already have the current value available.

PS. I'm glad you managed to get that working from the linked article Lucie. Good for you.
Sep 29 '09 #4

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

Similar topics

9
6741
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
4
64528
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...
2
2268
by: SPOILED36 | last post by:
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttendance, I also have cascading combo boxes (cboCategory and...
3
3687
by: buddyr | last post by:
Hello, Yesterday I recieved help with two cascading combo boxes on an access form. I went the link http://www.fontstuff.com/access/acctut10.htm And basically used their first example. Now I...
7
2525
kcdoell
by: kcdoell | last post by:
I have three tables: One for the Division location: tblDivision DivisionID = Autonumber DivisionName = Text One for the Working Region: tblWrkRegion
4
3458
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...
1
2659
kcdoell
by: kcdoell | last post by:
Good Morning: I have a form where I am trying to create cascading combo boxes. I have done this before but I am getting the following error that is throwing me off: Procedure declaration...
3
3968
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...
7
5817
by: Toireasa | last post by:
Hi, Newbie Access developer here, and my first post on this forum, so I might not get everything right - thanks in advance for your help and your patience! I'm using Access 2007, in XP. I'm...
0
7132
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
7336
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
7401
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
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
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
4720
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...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.