473,549 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ 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 4839
NeoPa
32,564 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,564 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,564 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,564 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
2059
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 I've got a subform with a series of cascading combo boxes (thanks to the Access tutorials on fontstuff.com) that let the user assign categories to...
3
5330
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 what you can make of this... I have a main form "Events" that contains a tab control. The tab control has 7 pages. The 7th page (named "Boats")...
1
2388
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 boxes, one which selects the category, and the other contains the contents of the category. These combo boxes are linked as in all the examples out...
2
2306
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 single item form. However as the form I need is a of tabular type, every time I update cbo1 to a value, the non matching cbo1's cbo2 field blanks...
2
2276
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 cboException) to filter difference absences (ie.Regular, Overtime, etc). cboCategory is filtered as follows: !!... Because I have the subform set...
3
3688
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 may need 3 cascading combo boxes and I cannot figure out how to do that. Can you help? Thank you
4
3472
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 below. tblOrg OrgID, AutoNumber, PK ZipID, Number, FK tblState StateID, AutoNumber, PK
4
1593
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 contents and I have used those methods on "form view" forms, but they don't lend themselves to datasheet forms. One thing, of course, is to set the...
7
5820
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 currently trying to set up a whole pile of cascading combo boxes of different levels of complexity, so I started with the easiest set - and can't even...
0
2018
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 the subform the sorting function activated by the column header click only works once, the second time the user tries a sort an error occurs ("Data...
0
7467
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7500
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7827
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5110
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3514
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3494
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1961
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1079
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
783
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.