473,416 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Referencing a control on a tabbed form

Hello,
I have a tabbed form. On each tab there is a subform. On Subform1 I have a series of combo boxes whose names are Combo1, Combo2, Combo3, etc. and button that if the user clicks will write the word "Yes" in all the combo boxes on the form. The line of code that works for the first combo box is:
Expand|Select|Wrap|Line Numbers
  1. Forms!frmMain.Subform1.Form.Combo1 = "Yes"
I want to have the same functionality on Subform2. On Subform2 I have the same line of code, except it references Subform2
Expand|Select|Wrap|Line Numbers
  1. Forms!frmMain.Subform2Form.Combo1 = "Yes"
When I click the button the second subform I get a run time error 2465 Application defined or object defined error.

If the line of code works on Subform1, why does it throw this error on Subform2 and what can I do to achieve the functionality I desire on Subform2?
Jun 13 '23 #1

✓ answered by cactusdata

You miss a dot:
Expand|Select|Wrap|Line Numbers
  1. Forms!frmMain!Subform2.Form!Combo1 = "Yes"
  2. ' or, if the button is on the main form:
  3. Me!Subform2.Form!Combo1.Value = "Yes"
  4. ' or, if the button is on the subform:
  5. Me!Combo1.Value = "Yes"
Also, rename your controls to something meaningful.

2 20857
cactusdata
214 Expert 128KB
You miss a dot:
Expand|Select|Wrap|Line Numbers
  1. Forms!frmMain!Subform2.Form!Combo1 = "Yes"
  2. ' or, if the button is on the main form:
  3. Me!Subform2.Form!Combo1.Value = "Yes"
  4. ' or, if the button is on the subform:
  5. Me!Combo1.Value = "Yes"
Also, rename your controls to something meaningful.
Jun 14 '23 #2
NeoPa
32,556 Expert Mod 16PB
Indeed so. Cactus' response is perfect & I've marked it as "Best Answer" for you.
Jun 16 '23 #3

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

Similar topics

6
by: David | last post by:
Ok. Can PHP control a form value directly? Eg. like the javascript "document.Form1.text01.value = "Y"". Eg. allow me to put a value into a form text field on page load. Either I missed this in...
0
by: Heather | last post by:
I know Steve Lebans has code for changing colors of tabs/pages when active but the code is so complex I can't follow it to pick out the parts I need. I just want to make the current page name bold...
6
by: MP | last post by:
Hello I want to have a public property (and Brows able) in one control, I use this code: public System.Windows.Forms.Form recordForm get { return _recordForm;} set {_recordForm = value;}
2
by: MLH | last post by:
A97 Am having difficulty displaying graph in Form View that I see fine in graph control on form opened in design view. I know I'm doing something wrong. If I open the form in design view - I...
9
by: Mary | last post by:
I have a tabbed form. Tab 1 has fields that are mandatory. I am trying to validate that these fields are not null, and cancel updating if any of them are. The following code works, except the form...
1
by: bbatson | last post by:
Hello, I've recently created a tabbed form. The forms within the tabbed form have command buttons that create reports based on queries that are driven by the forms (based on the !! setup). The...
3
by: =?Utf-8?B?Y2xhcmE=?= | last post by:
Hi all, How to make a tabbed form ? I tried to use Flowlayoutpanel and failed. Clara thank you so much for your help
2
by: bbatson | last post by:
Hello, I can't seem to figure out how to prevent a tabbed form from changing colors toward the bottom half of the form. See image below: http://img236.imageshack.us/img236/8652/postbz5.jpg ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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
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...

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.