473,609 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dot or a bang?

MLH
?DCount("[tblCorresponden ce]![VehicleJobID]", "qryAOLsNeed2Pr int")
- OR -
?DCount("[tblCorresponden ce].[VehicleJobID]", "qryAOLsNeed2Pr int")

Both syntaxes return the correct answer for me. But I'm wondering if
one is more suitable than the other for some reason. I'm using A97.
May 23 '06 #1
10 2546
MLH <CR**@NorthStat e.net> wrote in
news:3p******** *************** *********@4ax.c om:
?DCount("[tblCorresponden ce]![VehicleJobID]",
"qryAOLsNeed2Pr int")
- OR -
?DCount("[tblCorresponden ce].[VehicleJobID]",
"qryAOLsNeed2Pr int")

Both syntaxes return the correct answer for me. But I'm
wondering if one is more suitable than the other for some
reason. I'm using A97.

the bang is the syntactically correct way. Access allows several
errors of syntax, most of the time. You must use a bang to refer
to a field name in a recordset DAOrs.LastName will return an
error, DAOrs!Lastname will return the value of that field.

Personally, I tend to think more highly of people who say, "Is
this not the correct method?" than those would growl "Ai'nt this
rite?" :-)
--
Bob Quintal

PA is y I've altered my email address.
May 23 '06 #2
MLH
<snip>
the bang is the syntactically correct way. Access allows several
errors of syntax, most of the time. You must use a bang to refer
to a field name in a recordset DAOrs.LastName will return an
error, DAOrs!Lastname will return the value of that field. Many thx. I think I'll stick with the syntactically correct way.

Personally, I tend to think more highly of people who say, "Is
this not the correct method?" than those would growl "Ai'nt this
rite?" :-)

I'm glad I didn't growl.
May 24 '06 #3
The dot is the syntactically correct way. Access allows several
syntax variations, most of the time. But by definition you should
use a dot to refer to a field name in SQL, and you might as well
get used to it.

In Access and DAO, TblName!FieldNa me will return the same value,
but if you open the query in design view, access will display it
as "Expr1: TblName!FieldNa me". That is, Access understands what
you want, but it's been interpreted as an expression, rather than
as ordinary SQL.

(david)

PS: Personally, I tend to think more highly of people who say,
"It's a machine: I accept that it's behaviour is not morally
determined"


"MLH" <CR**@NorthStat e.net> wrote in message
news:3p******** *************** *********@4ax.c om...
?DCount("[tblCorresponden ce]![VehicleJobID]", "qryAOLsNeed2Pr int")
- OR -
?DCount("[tblCorresponden ce].[VehicleJobID]", "qryAOLsNeed2Pr int")

Both syntaxes return the correct answer for me. But I'm wondering if
one is more suitable than the other for some reason. I'm using A97.

May 24 '06 #4
MLH
OK. 2 differing opinions here. Is there some A97 HELP
blurb that supports either opinion?
May 24 '06 #5
A bang (!) is used where what follows is a member of a collection. A dot (.)
is used where what follows is a property or method of the preceding object.
Strictly adhering to this, your code will always work. In some cases
however, what follows may be a member of a collection or a property making
the Bang(!) or Dot(.) appropriate. In these cases, there is an advantage to
using the Dot(.) as it makes the "intellisen se" dropdown lists available
where the Bang(!) would not. The disadvantage is that you got to know when
to hold them and know when to fold them. The Dot (.) does not universally
work. As far as performance is concerned, there is no noticeable difference
one way or another.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1175 users have come to me from the newsgroups requesting help
re******@pcdata sheet.com

"MLH" <CR**@NorthStat e.net> wrote in message
news:nv******** *************** *********@4ax.c om...
OK. 2 differing opinions here. Is there some A97 HELP
blurb that supports either opinion?

May 26 '06 #6
* PC Datasheet:
A bang (!) is used where what follows is a member of a collection. A dot (.)
is used where what follows is a property or method of the preceding object.
Strictly adhering to this, your code will always work. In some cases
however, what follows may be a member of a collection or a property making
the Bang(!) or Dot(.) appropriate. In these cases, there is an advantage to
using the Dot(.) as it makes the "intellisen se" dropdown lists available
where the Bang(!) would not. The disadvantage is that you got to know when
to hold them and know when to fold them. The Dot (.) does not universally
work. As far as performance is concerned, there is no noticeable difference
one way or another.

--
To anyone reading this thread:

It is commonly accepted that these newsgroups are for free
exchange of information. Please be aware that PC Datasheet
is a notorious job hunter. If you are considering doing
business with him then I suggest that you take a look at
the link below first.

http://home.tiscali.nl/arracom/whoissteve.html

Randy Harris
May 26 '06 #7
A Table, Recordset has a collection of fields as a property. Each item
in the fields collection is accessible by index, name or ordinal.
The use of the bang conceals this, by short-circuiting

recordset.field s(index).value
to
recordset!index

I cannot think that the latter is "the syntactically correct way". I
have not used a bang for many years. I think this makes my code clearer
and less prone to error.

IMO the best way (a la Dimitri Furman) to deal with any property of a
field is to declare and intialize a reference to the specific field:
Dim f as DAO/ADO.Field
..
..
..
Set f = r.Fields("Water melon")
..
..
..
Debug.Print f.Value

Previous tests in CDMA have shown that for repeated reference this is
the fastest way.

May 26 '06 #8
Un this case, we were looking at the first parameter
(field identifier) for a domain function. There is no DAO
or Access recordset or collection.

Domain Functions take SQL strings as parameters.

So the presumption is that JET SQL syntax should be used.

Which is
databasename.ta blename.fieldna me
or
[databasename].[tablename].[fieldname]

The Jet SQL expression evaluator will also accept
expressions of the form:
tablename!field name
or
(tablename!fiel dname)
or
(1*(0+tablename !fieldname)) as n

as
v = dcount("(1*(0+t ablename!fieldn ame)) as n","tablenam e")

Using an expression instead of a fieldname in your SQL
prevents some optimisations, but is generally irrelevant.
However, even more than in VB, it wouldn't normally be
considered good practice.

(david)

"Lyle Fairfield" <ly***********@ aim.com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.com.. .
A Table, Recordset has a collection of fields as a property. Each item
in the fields collection is accessible by index, name or ordinal.
The use of the bang conceals this, by short-circuiting

recordset.field s(index).value
to
recordset!index

I cannot think that the latter is "the syntactically correct way". I
have not used a bang for many years. I think this makes my code clearer
and less prone to error.

IMO the best way (a la Dimitri Furman) to deal with any property of a
field is to declare and intialize a reference to the specific field:
Dim f as DAO/ADO.Field
.
.
.
Set f = r.Fields("Water melon")
.
.
.
Debug.Print f.Value

Previous tests in CDMA have shown that for repeated reference this is
the fastest way.

May 27 '06 #9
I was responding to this assertion: "You must use a bang to refer
to a field name in a recordset DAOrs.LastName will return an
error, DAOrs!Lastname will return the value of that field."

Upon re-reading I can see this was beyond the original example.

I do not use Domain Aggregate Functions. The issue of the expression
went right by me.

May 27 '06 #10

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

Similar topics

5
1755
by: Mike Ayers | last post by:
Here is what I have: A lamp box (Linux,apache,mysql,php) that has >= 2.4Ghz Pentium 4, 1Gig Ram, 2 40 Gig IDE harddrives (OS on one/mysql on the other). The mysql database is getting large (several tables have several million rows each). I have done a lot of work on indexes. The system is on our corporate intranet. The problem is it can get very slow. My question is what will give me the biggest bang for my (bosses) buck? More ram?
3
4702
by: deko | last post by:
all this dot and bang syntax is confusing. if anyone can bring clarity to this subject I would really appreciate it. Forms!!.Form! -- to reference a text box on a subform But is this the same in a query?? Forms!frmMain!frmSub!ctl_on_Sub -- to reference a textbox on a sub form in a query
44
7057
by: Darryl Kerkeslager | last post by:
I once did all my control references with the bang (!) operator. All my controls were referenced as Me!txtInput, etc. I have now discovered that doing this loses much more than Intellisense. 1. Compile does not pick up missing controls, i.e., if I have a reference to Me!btnEdit, and remove that button from my form, Compile will not show a warning. It *will* show a warning if I have referenced my control as Me.btnEdit.
4
14700
by: Richard | last post by:
What is the difference between Me.Lastname Me!Lastname TIA
2
3112
by: CoreyWhite | last post by:
When playing games, perhaps the most simple is tic-tac-toe. The game has two simple strategies, one is defensive and the other offensive. It is not hard at first to learn how to tie games when playing an opponent. And then the next stage in development comes after you learn how to beat an opponent. You really can only employ either strategy when you get to make the first move, and your opponent will quickly learn what you are doing...
0
8130
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
8076
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
8541
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
8406
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...
0
7002
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6057
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
4021
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
4085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1672
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.