473,757 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Differences - Syntax & Form operations

MS
Just a general question here re VBA.

Can anyone explain the differences between "!" and "." when refering to a control?

eg Me!TxtBox and Me.TxtBox.

What is difference between "+" and "&" when working with strings.

eg MyStr = "I have " & MyNumber & " apples." and MyStr = "I have " + MyNumber + " apples."

Also, what are the differences between Loading a form and Opening a form, Similarly with Unload and Close.

From my observations, all the above pairs achieve the same things - I find I can interchange them without noticing any differences. Are there subtle differences, or are they basically the same?

Cheers!

Nov 13 '05 #1
4 3709
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bang (!) and dot (.) - basically the same. The exclamation point (bang)
means refer to the collection item. Since Me refers to the form, and
the form's default collection is Controls then Me!TxtBox refers to the
control "TxtBox" in the form's Controls collection.

The period (dot) means refer to the property. A control can also be a
property of the form, so Me.TxtBox refers to the control/property
"txtBox" and also any Field named "txtBox" in the form's Recordsource.

The ampersand (&) is purely a string concatenation operator. The plus
sign (+) is also a concatenation operator that sets the string to NULL
if NULL is the last value. E.g. (debug window):

? null & "this one" + null + " that one"
Null

? null & "this one" & null & " that one"
this one that one

Loading & Opening a form: Opening a form can be cancelled. Loading
can't cancel the opening of the form.

Unload & Close a form: Unload can be cancelled. Closing can't.

The order of events is:

Open: Open -> Load -> ...

Close: Unload -> Deactivate -> Close

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQgrwxIechKq OuFEgEQKBNwCfen AA416mTzhOck3MU R1O+AWkBEQAnRgL
g9AVXzhKnM09otw UeRoUqCYa
=amVt
-----END PGP SIGNATURE-----
MS wrote:
Just a general question here re VBA.

Can anyone explain the differences between "!" and "." when refering to a control?

eg Me!TxtBox and Me.TxtBox.

What is difference between "+" and "&" when working with strings.

eg MyStr = "I have " & MyNumber & " apples." and MyStr = "I have " + MyNumber + " apples."

Also, what are the differences between Loading a form and Opening a form, Similarly with Unload and Close.

From my observations, all the above pairs achieve the same things - I find I can interchange them without noticing any differences. Are there subtle differences, or are they basically the same?

Cheers!

Nov 13 '05 #2
MS

"MGFoster" <me@privacy.com > wrote in message
news:bh******** *********@newsr ead3.news.pas.e arthlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bang (!) and dot (.) - basically the same. The exclamation point (bang)
means refer to the collection item. Since Me refers to the form, and
the form's default collection is Controls then Me!TxtBox refers to the
control "TxtBox" in the form's Controls collection.

The period (dot) means refer to the property. A control can also be a
property of the form, so Me.TxtBox refers to the control/property
"txtBox" and also any Field named "txtBox" in the form's Recordsource.

The ampersand (&) is purely a string concatenation operator. The plus
sign (+) is also a concatenation operator that sets the string to NULL
if NULL is the last value. E.g. (debug window):

? null & "this one" + null + " that one"
Null

? null & "this one" & null & " that one"
this one that one

Loading & Opening a form: Opening a form can be cancelled. Loading
can't cancel the opening of the form.

Unload & Close a form: Unload can be cancelled. Closing can't.

The order of events is:

Open: Open -> Load -> ...

Close: Unload -> Deactivate -> Close

Thanks! :-)
Nov 13 '05 #3
MGFoster wrote:
The period (dot) means refer to the property. A control can also be a
property of the form, so Me.TxtBox refers to the control/property
"txtBox" and also any Field named "txtBox" in the form's Recordsource.


Steer clear of using a dot for controls/fields, in some versions of
Access in cirtain circumstances it won't compile anyway and there's the
danger that some numpty named a field/control something like "Name" so
that Me.Name is now ambiguous. Doesn't need a numpty either, you can
name something perfectly sensible then MS make that name a keyword in
the next version of Access.

--
This sig left intentionally blank
Nov 13 '05 #4
Trevor Best <no****@besty.o rg.uk> wrote in
news:42******** **************@ news.zen.co.uk:
MGFoster wrote:
The period (dot) means refer to the property. A control can
also be a property of the form, so Me.TxtBox refers to the
control/property "txtBox" and also any Field named "txtBox"
in the form's Recordsource.


Steer clear of using a dot for controls/fields, in some
versions of Access in cirtain circumstances it won't compile
anyway and there's the danger that some numpty named a
field/control something like "Name" so that Me.Name is now
ambiguous. Doesn't need a numpty either, you can name
something perfectly sensible then MS make that name a keyword
in the next version of Access.

Even more insidious is a translation. Wrote some code using french
field names: nom, prénom, addresse, téléphone. It worked fine on my
english version of Access '97, but failed with the "nom est un mot
réservé" message when run on my customer's french version of Access
'97. grrrr!

--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #5

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

Similar topics

3
12409
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I have tried many combinations to do this, but has yet to try the right one. How is it done? 2) What kinds of file operations can be done in Javascript (save,
4
2496
by: Jian H. Li | last post by:
Hello, What's the essential differences between the two ways of "class::member" & "object.member"(or object_pointer->member)? class C{ public: void f() {} int i; };
31
3679
by: JS | last post by:
We have the same floating point intensive C++ program that runs on Windows on Intel chip and on Sun Solaris on SPARC chips. The program reads the exactly the same input files on the two platforms. However, they generate slightly different results for floating point numbers. Are they really supposed to generate exactly the same results? I guess so because both platforms are supposed to be IEEE floating point standard (754?) compliant. ...
1
1925
by: Jeff | last post by:
I am getting Unable to find operator in query string. Query string currently is INSERT INTO Results (Name,Email,Comments,File) VALUES ('::Name::','::Email::','::Comments::','::File::') Here is the ASP Code..From Frontpage. <html>
1
1449
by: dirk van waes | last post by:
Hello everyone, Being complete newbie in asp.net I am trying to make an example which works with a very simple database. First I made my project in VS- vb.net, draging an oledbconnection and an oledbdataadapter from the toolbox into my form. Everything worked fine on my local computer. I was able to search, update, delete and insert into my klanten.mdb database.
17
2036
by: Dinsdale | last post by:
I would like to compare a string value to a pre-determined list of other strings. Is there a simple way to do this in one statements like this: if(strMystring.ToUpper() == ("STRING1"| "STRING2"| "STRINGX")) {} This syntax doesn't work (and in fact I'm not quite sure what this statement really is saying) but I'd like to be able to do *something* like this. One suggestion was to add the compare strings to an
2
5168
by: trpost | last post by:
I hope this is a simple fix, but it has been driving me crazy, I have the following code, that errors out with a syntax error: <INPUT TYPE=button OnClick=javascript:window.location='edit.php?action=remote&ID=1234&pw='+this.form.password.value+; VALUE=remote update> The specific piece that I narrowed the error down to is: +this.form.password.value+;
10
10790
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language Aquisition Device (2) Color Aqusition Device (3) Sound Aquistion Device (4) Smell Aquisition Device (5) Touch Aquisition Device (6) Art Aquisition Device
23
4369
by: Hallvard B Furuseth | last post by:
As far as I can tell, (x & -1) is nonzero if the integer x is negative zero. So for signed types, x == 0 does not guarantee (x & foo) == 0. Is that right? (Not that I expect to ever encounter a non-two's-complement machine. Just wondering.) -- Hallvard
0
9297
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9735
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
7285
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
5168
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
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.