473,796 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Value of Control on SubForm

All,

I have a form (FRM_ShowAll) on which I have placed a number of
instances of the same sub-form (FRM_Assign) as different child forms
(SFRM_Agent, SFRM_Executor, etc.). The sub-form is a continuous form.

I would like to specify a different Value or Default Value for a combo
box (CB_Role) on each instance of the subform control in code. The
combo box CB_Role is fed from a lookup in the source table,

I can set the DefaultValue in the control properties of the form
object, but that makes it impossible for me to re-use the same form as
separate instances of child forms.

I've read and typed 'til I'm blurry, but I can't get it to work. I
have tried each different line of code below in the OnLoad event in
the Master form (FRM_ShowAll) and in the OnEnter event of the sub-form
(FRM_Assign). The code is being executed, but no value is being
selected.

Me.SFRM_Agent.C ontrols(CB_Role ).Value = Executor
Me.SFRM_Agent.C ontrols(CB_Role ).Value = "Executor" - Shows error Value
not in List
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = Executor
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = "Executor"
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = """Executor """

Any ideas?

Thanks,

Patrick

Sep 24 '07 #1
2 7362
On Sep 24, 4:57 pm, Patrick A <park...@stradl ey.comwrote:
All,

I have a form (FRM_ShowAll) on which I have placed a number of
instances of the same sub-form (FRM_Assign) as different child forms
(SFRM_Agent, SFRM_Executor, etc.). The sub-form is a continuous form.

I would like to specify a different Value or Default Value for a combo
box (CB_Role) on each instance of the subform control in code. The
combo box CB_Role is fed from a lookup in the source table,

I can set the DefaultValue in the control properties of the form
object, but that makes it impossible for me to re-use the same form as
separate instances of child forms.

I've read and typed 'til I'm blurry, but I can't get it to work. I
have tried each different line of code below in the OnLoad event in
the Master form (FRM_ShowAll) and in the OnEnter event of the sub-form
(FRM_Assign). The code is being executed, but no value is being
selected.

Me.SFRM_Agent.C ontrols(CB_Role ).Value = Executor
Me.SFRM_Agent.C ontrols(CB_Role ).Value = "Executor" - Shows error Value
not in List
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = Executor
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = "Executor"
Me.SFRM_Agent.C ontrols(CB_Role ).DefaultValue = """Executor """

Any ideas?

Thanks,

Patrick
If I understand you correctly, you want a composite combobox which
reads uses a table as its source but also allows an item "Executor"
which is not in the table. The only way I know how to do this is to
change the combobox source to a list type, and manually generate the
list from the table, adding "Executor" as you go. Then attach the
list as the combobox source.

Sep 25 '07 #2
Thanks, I have that part working.

What I couldn't get working was "making the selection"
programmaticall y. I was able to work around this by placing an
unbound textbox on the Parent form, setting based on the subform the
user entered, and writing it back to the subform on the After Update
event of the child form.

I'm still interested in the proper syntax to achieve my first attempt
from an "academic" perspective, but as of 12 minutes ago, I've got
this working.

Sep 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8238
by: Terry Bickle | last post by:
Please forgive me for using the wrong term here or there. I'm an old Excel 4 macro guy who didn't convert to VB and I'm tinkering with an Access 2000 DB. I'm sure there is a simple Access 101 answer for this. I have a subform which the user selects an item description from a combo box from a table. I want to obtain the cost for the item (another field in the table) also. I've been able to produce the second data field by rewriting the...
12
19017
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course, frmBrowseNegsSubform. I would like to perform an ascending or descending sort on any of the 7 columns shown in datasheet view in the subform control. I've been unsuccessful. Is there something tricky about sorting in subform controls?
1
8522
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a subform of the subform. the main Form is called Subform is called Subform in the subform is called
4
1768
by: Gerry Abbott | last post by:
Hi all, A subForm control, txtTotalSubForm contains a total from one of the fields on this subForm . The mainForm contains a combo, myCombo which filters, and updates the details on the subForm. I want this update to pass the value in txtTotalSubForm to a control txtMainForm, on the main form. Ive tried using the parent property, but this is not adequate since I must click onto the subform to trigger it (on current event of the subform)....
6
7495
by: Rick | last post by:
I have a main form called frmDemo with a subform frmStageTrack_Sub. On the subform is a Combo Box CboTermID. The frmDemo is tied to tblDemo and the frmStageTrack_Sub is tied to tblStageTrack. What I would like to do is when a new record is created in frmDemo I would like to set the CboTermID on the subform to a default value, say 1, without the user having to set focus on the subform and selecting an item from the combo box. Right now...
1
2413
by: hakunamatata5254 | last post by:
Hi all, In my project of multiple forms (main form, subform1, 2 , 3 etc) (Main form is Employees, Subforms are Attendance, salary details, payment) Now i want to calculate the payment based on the salary details (Basic, Allowances etc) and the attendance (days worked and overtime hours). Overtime pay should be based on the basic only. Maybe the following codes/syntax (from microsoft) will help. To refer to a control on a subform,...
9
9711
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
3
7704
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter value" pop up for each reference to the parent control in the query when the main form is closed. ...
5
3239
by: vsteshenko | last post by:
Hello, This is my second post to the any usernet group and the first one was posted to the wrong one. I am currently working on creating an order form for sales associates at my work to be used at conventions. I have a main form with two subforms. On the main form, there is a text box that displays the sum of total orders entered in the subform, . I'm trying to create another text box on the main form, that looks at the subtotal...
0
1373
by: skips84s | last post by:
I have a parent form with four tabbed subforms. On subform x, selecting a value from a combo box should update a few controls on this subform, as well as a control on subform y, all done using dlookups. Each of the controls does have a valid control source in the same table. Right now, I can update the controls on subform x with no problem. When I add the code to update subform y, however, the control in subform y updates and saves the...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10465
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10200
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6800
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5453
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2931
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.