473,385 Members | 1,218 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,385 software developers and data experts.

Dot or a bang?

MLH
?DCount("[tblCorrespondence]![VehicleJobID]", "qryAOLsNeed2Print")
- OR -
?DCount("[tblCorrespondence].[VehicleJobID]", "qryAOLsNeed2Print")

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 2520
MLH <CR**@NorthState.net> wrote in
news:3p********************************@4ax.com:
?DCount("[tblCorrespondence]![VehicleJobID]",
"qryAOLsNeed2Print")
- OR -
?DCount("[tblCorrespondence].[VehicleJobID]",
"qryAOLsNeed2Print")

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!FieldName will return the same value,
but if you open the query in design view, access will display it
as "Expr1: TblName!FieldName". 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**@NorthState.net> wrote in message
news:3p********************************@4ax.com...
?DCount("[tblCorrespondence]![VehicleJobID]", "qryAOLsNeed2Print")
- OR -
?DCount("[tblCorrespondence].[VehicleJobID]", "qryAOLsNeed2Print")

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 "intellisense" 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******@pcdatasheet.com

"MLH" <CR**@NorthState.net> wrote in message
news:nv********************************@4ax.com...
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 "intellisense" 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.fields(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("Watermelon")
..
..
..
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.tablename.fieldname
or
[databasename].[tablename].[fieldname]

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

as
v = dcount("(1*(0+tablename!fieldname)) as n","tablename")

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.googlegr oups.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.fields(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("Watermelon")
.
.
.
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
IIRC for A97 and before Microsoft said you should use the bang, from A2k
onwards they said use the dot.

Pragmatically, if it gives the same result don't worry about it.

Personally I would use the dot as this is the syntax in SQL Server and you
might as well get used to using it in case you ever switch over.
..

--

Terry Kreft
"MLH" <CR**@NorthState.net> wrote in message
news:3p********************************@4ax.com...
?DCount("[tblCorrespondence]![VehicleJobID]", "qryAOLsNeed2Print")
- OR -
?DCount("[tblCorrespondence].[VehicleJobID]", "qryAOLsNeed2Print")

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 28 '06 #11

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

Similar topics

5
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...
3
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...
44
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. ...
4
by: Richard | last post by:
What is the difference between Me.Lastname Me!Lastname TIA
2
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.