473,395 Members | 2,795 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,395 software developers and data experts.

Forms and Form

Hi everyone !

1) An example from help:

"Each Form object has a Controls collection, which contains all
controls on the form. You can refer to a control on a form either
by implicitly or explicitly referring to the Controls collection. Your
code will be faster if you refer to the Controls collection implicitly.
The following examples show two of the ways you might refer
to a control named NewData on the form called OrderForm:

' Implicit reference.
Forms!OrderForm!NewData

' Explicit reference.
Forms!OrderForm.Controls!NewData

The next two examples show how you might refer to a control named NewData on
a subform ctlSubForm contained in the form called OrderForm:

Forms!OrderForm.ctlSubForm.Form!Controls.NewData
Forms!OrderForm.ctlSubForm!NewData"

Why is there a "." character after the name of the main form ? (and
the same with a dot after "Controls" property). It's not a method
or property ... And if you look at other key-word "Form, Report
Properties" there is also an example:

intOrderID = Forms!Orders!OrderDetails.Form!OrderID

And now - there is a "!" - not "." wich is more logical for me.
Why wasn't it this way in the last example ?

And one more thing - I don't understand the meaning of property
"form" - why to refer to itself ? Can't we refer just this way:

Forms!Orders!OrdersDetails!OrderID ???

If we can do that in this way, why to use "form" property ?

Thanks for all answers.

PS. I use MS Access 2000 version 9.0.2812
Nov 12 '05 #1
4 2401
In many cases, the dot and the bang are interchangable.
In other cases, one or the other is required, and the wrong one won't work.
Personally, I don't get too excited about the theoretical underpinnings; I
just use what works.

As for your question about the Form property, that one IS significant.
Forms!Orders!OrderDetails refers to the subform control, which is located on
the form Orders.
This subform control contains a form, which is accessible using its Form
property.
The controls on the subform belong to this form, not to the subform control.
Although I, too, have seen this form in help files:
Forms!OrderForm.ctlSubForm!NewData
I have never been successful in making it work without referring to the Form
property of the subform control.

Pozdrowienia
- Turtle
"Soryt" <di**@wp.pl> wrote in message
news:br**********@atlantis.news.tpi.pl...
Hi everyone !

1) An example from help:

"Each Form object has a Controls collection, which contains all
controls on the form. You can refer to a control on a form either
by implicitly or explicitly referring to the Controls collection. Your
code will be faster if you refer to the Controls collection implicitly.
The following examples show two of the ways you might refer
to a control named NewData on the form called OrderForm:

' Implicit reference.
Forms!OrderForm!NewData

' Explicit reference.
Forms!OrderForm.Controls!NewData

The next two examples show how you might refer to a control named NewData on a subform ctlSubForm contained in the form called OrderForm:

Forms!OrderForm.ctlSubForm.Form!Controls.NewData
Forms!OrderForm.ctlSubForm!NewData"

Why is there a "." character after the name of the main form ? (and
the same with a dot after "Controls" property). It's not a method
or property ... And if you look at other key-word "Form, Report
Properties" there is also an example:

intOrderID = Forms!Orders!OrderDetails.Form!OrderID

And now - there is a "!" - not "." wich is more logical for me.
Why wasn't it this way in the last example ?

And one more thing - I don't understand the meaning of property
"form" - why to refer to itself ? Can't we refer just this way:

Forms!Orders!OrdersDetails!OrderID ???

If we can do that in this way, why to use "form" property ?

Thanks for all answers.

PS. I use MS Access 2000 version 9.0.2812

Nov 12 '05 #2
[...]
The controls on the subform belong to this form, not to the subform control. Although I, too, have seen this form in help files:
Forms!OrderForm.ctlSubForm!NewData
I have never been successful in making it work without referring to the Form property of the subform control.
Does it mean that if I use an expression:

Forms!OrderForm.ctlSubForm!NewData

then I refer to NewData of the main form ?
If it is so, then I get it :D

Thanks for your quick reply.
Pozdrowienia
- Turtle


Również pozdrawiam,
Adrian :)
Nov 12 '05 #3
I have never found the expression
Forms!OrderForm.ctlSubForm!NewData
to be useful for anything.
Forms!OrderForm.ctlSubForm
refers to the subform control;
you can use it to access properties such as Top, Left, which are
common to all controls, as well as specific properties like LinkMasterFields
and LinkChildFields.
In general, these are properties that relate the subform control to
the main form it's sitting on.

Another one of the properties of a subform control is its .Form property.
This is a reference to the form which is contained in the form.
Through this property, you can reference all of the properties of that
form -
including all its controls, its recordset, etc.

To reference the control NewData on the main form, there's no need to make
any reference to the subform control at all -
that would just be
Forms!OrderForm!NewData

HTH
- Turtle
"Soryt" <di**@wp.pl> wrote in message
news:br**********@nemesis.news.tpi.pl...
[...]
The controls on the subform belong to this form, not to the subform

control.
Although I, too, have seen this form in help files:
Forms!OrderForm.ctlSubForm!NewData
I have never been successful in making it work without referring to the

Form
property of the subform control.


Does it mean that if I use an expression:

Forms!OrderForm.ctlSubForm!NewData

then I refer to NewData of the main form ?
If it is so, then I get it :D

Thanks for your quick reply.
Pozdrowienia
- Turtle


Również pozdrawiam,
Adrian :)

Nov 12 '05 #4
[...]
To reference the control NewData on the main form, there's no need to make
any reference to the subform control at all -
that would just be
Forms!OrderForm!NewData


Thank you for your comprehensive answer.

Regards,

Adrian.

PS. I wonder why Forms!OrderForm.ctlSubForm!NewData
works on my computer ... In my opinion Access should throw
an exception, but it doesn't ... :\
Nov 12 '05 #5

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

Similar topics

6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
7
by: Sergey Poberezovskiy | last post by:
Hi, I created two base forms: frmList and frmDetail, compiled them into a dll, and then want to use in my new project. The problem: When I created new inherited form, say frmClients, I cannot...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
21
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
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
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
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.