473,493 Members | 4,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cascading Combo boxes in a subform in datasheet view

4 New Member
I've used Access for some time but nver had to use any code. Ive a problem getting combo boxes to cascade in a sub form, I've done some searches and the problem appears to be in the identifaction of the relevant elements. I've been mucking around with a sample database and it has the following code in an event procedure
the main form is Form1
the subform is Bound Combo form

Expand|Select|Wrap|Line Numbers
  1. Private Sub Category_AfterUpdate()
  2. Product = Null
  3. Product.Requery 
  4. Product = Forms![Form1].[Bound Combo Form].Form.Product.ItemData(0)
  5. End Sub
  6.  
  7. Private Sub Form_Current()
  8. Forms![Form1].[Bound Combo Form].Form.Product.Requery
  9. End Sub
  10.  
  11. Private Sub Form_Load()
  12. If IsNull(Category) Then
  13.   Category = Forms![Form1].[Bound Combo Form].Form!ItemData(0)
  14.   Call Category_AfterUpdate
  15. End If
  16. End Sub
Cheers
Cliff
Feb 15 '12 #1
7 4827
NeoPa
32,556 Recognized Expert Moderator MVP
Have a look through Cascaded Form Filtering. It should help.
Feb 15 '12 #2
cliffschooling
4 New Member
Had a look at this but it'snot quite what I need.
Ineteresting non the less.
Thanks
Cliff
Feb 16 '12 #3
NeoPa
32,556 Recognized Expert Moderator MVP
If you're working in Datasheet view, then there are elements of the form which won't work. Controls are disabled in many ways, and just the underlying fields are used in a basic way.
Feb 16 '12 #4
cliffschooling
4 New Member
I rehashed it and changed the form to Continuous forms and managed to get the 2nd combo box working OK but cant figure out the 3rd level. This code is in the After Update event procedure in the 1st combo box DTCode
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub DTCode_AfterUpdate()
  4. DTCodeSub = Null
  5. DTCodeSub.Requery  'Forms![MainForm].[SubForm].Form.Requery
  6. DTCodeSub = Forms![Ftimesheet].[FDT].Form.DTCodeSub.ItemData(0)
  7. End Sub
  8.  
  9. Private Sub Form_Current()
  10. Forms![Ftimesheet].[FDT].Form.DTCodeSub.Requery
  11. End Sub
  12.  
  13. Private Sub Form_Load()
  14. If IsNull(DTCode) Then
  15.   DTCode = Forms![Ftimesheet].[FDT].Form.ItemData(0) 'Form! changed to Form.
  16.   Call DTCode_AfterUpdate
  17. End If
  18. End Sub
Feb 16 '12 #5
NeoPa
32,556 Recognized Expert Moderator MVP
Please check out [code] Tags Must be Used.

Certainly Continuous Forms makes more sense to my way of thinking. You should understand though, that posting code is not a substitute for explaining your situation clearly. The code refers to various items that we have no clues about, so it's pretty tough trying to interpret what it is you're trying to ask (read: should be asking).
Feb 16 '12 #6
cliffschooling
4 New Member
Hi again
Sorry about that I havent had any experience of using VB so am kinda at sea here. All the work I've done in the past has been with queries etc.
What I'm trying to do is analyse the downtime on complex machinery, to this end I'm creating a from with 3 combo boxes linked to 3 tables
TDTCodeMain with fields IDmain incrementing and DTmain
TDTCodeSub with fields IDSub incrementing, IDmain and DTSub
TDTCodeSubSub with fields IDSubSub incrementing, IDSub and DTSubSub
I'm able to get the 2nd combo box to work ok, but the 3rd one is proving to be a we bit o a nuisance. I've tried applying the same code and SQL statements in the Row Source(with the names revised) to Combo boxes 2 & 3 but just get error messages galore, I'm abviously missing the trick here.
Thanks
Feb 17 '12 #7
NeoPa
32,556 Recognized Expert Moderator MVP
I don't seem to be getting my point across very clearly. Let me try again.

To be able to help you, we need a question explained clearly (preferably in the first post, but otherwise at least all in one post). Dropping clues of one form or another into posts now and again, with no common thread of explanation, doesn't make something we can help you with. I know that's quite hard for a lot of people (from observation if nothing else), but imagine yourself on the other side trying to make sense of a situation with such sparse information and explanation.

If you are having problems with any code, and you already have the pre-requisite of an explanation that puts the code into perspective, then you must follow the guidelines in Before Posting (VBA or SQL) Code. Trust me. This will save you time in the long run ;-)

My problem at this stage is that I have very unclear ideas as to the context your question even fits within. Answering detailed questions about such a situation puts me at an enormous disadvantage - hence my inability to help.
Feb 18 '12 #8

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

Similar topics

0
2049
by: cognoscento | last post by:
I'm currently putting together a database for my work (not an expert by any stretch, so muddling through as best as I can... you know the story...) and I could use some advice and hand-holding ...
3
5320
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see...
1
2386
by: MrPaulC | last post by:
Hey, I wonder if anyone can possibly help me with this problem. I'm really struggling with it. Ok, I have a form with a childform inside it which is in datasheet view, this form has two combo...
2
2293
by: ShadowHawk | last post by:
Hi Everyone. I've been having a little touble with a form I'm working on. (I'm a MS Access hobbiest). I've set up the cascading combo boxes, which is working, (I took the code from Microsoft) on a...
2
2263
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
3685
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...
4
3453
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...
4
1590
WyvsEyeView
by: WyvsEyeView | last post by:
I have a datasheet form in which one field is a combo box that will potentially contain hundreds of records. I've read about several methods of speeding up such combo boxes or limiting their initial...
7
5811
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
2012
by: clarkp73 | last post by:
Hi In VBA I populate an unbound subform (datasheet view) via a recordset that can be changed using filters selected by the user. The only problem I am having is that due to the unbound nature of...
0
7118
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
6980
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
7157
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
7192
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...
1
6862
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
7364
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...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4579
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
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.