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 - Private Sub Category_AfterUpdate()
-
Product = Null
-
Product.Requery
-
Product = Forms![Form1].[Bound Combo Form].Form.Product.ItemData(0)
-
End Sub
-
-
Private Sub Form_Current()
-
Forms![Form1].[Bound Combo Form].Form.Product.Requery
-
End Sub
-
-
Private Sub Form_Load()
-
If IsNull(Category) Then
-
Category = Forms![Form1].[Bound Combo Form].Form!ItemData(0)
-
Call Category_AfterUpdate
-
End If
-
End Sub
Cheers
Cliff
7 4839
Had a look at this but it'snot quite what I need.
Ineteresting non the less.
Thanks
Cliff
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.
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 - Option Compare Database
-
-
Private Sub DTCode_AfterUpdate()
-
DTCodeSub = Null
-
DTCodeSub.Requery 'Forms![MainForm].[SubForm].Form.Requery
-
DTCodeSub = Forms![Ftimesheet].[FDT].Form.DTCodeSub.ItemData(0)
-
End Sub
-
-
Private Sub Form_Current()
-
Forms![Ftimesheet].[FDT].Form.DTCodeSub.Requery
-
End Sub
-
-
Private Sub Form_Load()
-
If IsNull(DTCode) Then
-
DTCode = Forms![Ftimesheet].[FDT].Form.ItemData(0) 'Form! changed to Form.
-
Call DTCode_AfterUpdate
-
End If
-
End Sub
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).
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
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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")...
|
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...
|
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...
|
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...
| |
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
|
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
|
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...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |