Whoa. Let's not leap to conclusions.
It's NOT just a difference with the square brackets. Did you not notice
that Ken also ADDED quotes?
Your term was [dtmDate], which Ken changed to "dtmDate", but that could
also have been written as "[dtmDate]". It is the quotes that matter, not
the square brackets. (see the latter parts of the expression where there
are both quotes and square brackets, for example.)
So, to your question, "Why does Expression Builder put in the square
brackets?"
A couple of reasons, actually. First, whenever Access encounters spaces in
a name, it has no really good way to decide whether that means it should
interpret that as two separate names or not.
Let's take a fairly trivial example: "First Name". To you, a human with
years of experience reading text, it may seem pretty obvious that refers
to one thing, but spaces, in Access are usually delimiters, so to Access
the space between the words makes much more sense as two things, "First"
and "Name". As an aside, if I had MY way, no one would ever be allowed to
create field and table names with spaces in them, at least in part for
that very reason. And along the same lines, non standard characters like
*, # and ? should never be permitted in field names either, but my plan
for world domination is years from coming to fruition, so for now Access
still tolerates them as well.
Whenever there is a chance of ambiguity, therefore, Access must have SOME
way to disambiguate. Square brackets to the rescue!
To us, First Name and [First Name] are the same thing, but to Access,
there is a BIG difference. Again, belaboring the point a bit, the square
brackets are there to define unambiguously that [First Name] is a single
thing while, to Access, that is not clear at all.
The expression Builder sometimes seems to go overboard in placing square
brackets around everything, even though the chance of ambiguity is
relatively small. But that is a much better strategy for creating
executable expressions than letting them go on to be misinterpreted at run
time.
HTH
George
CJ said:
Well really, that's all!??!?!!
One wonders why the Expression Builder puts in the [ ] when they are
not necessary for the function. I should of caught it anyway.....
Thanks very much Ken!
--
Thanks for taking the time!
CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
Ken Snell said:
Assuming that your subform controls' names are correct:
=DMin("dtmDate","qryBlockOpen","[lngBlockID]= " &
[Forms]![frmProjectMaster]![fsubCompartments]![fsubBlocks]![lngBlockID])
--
Ken Snell
http://www.accessmvp.com/KDSnell/
Hi Groupies
I am on a sub sub form and I need to use the DMIN function to get the
lowest date from a query.
My syntax in the textbox is:
=DMin([dtmDate],"qryBlockOpen","[lngBlockID]= " &
[Forms]![frmProjectMaster]![fsubCompartments]![fsubBlocks]![lngBlockID])
The textbox is displaying the #Name? error. I have double checked the
name of everything so I'm not sure what the problem is. The textbox
just has the default name Text124 at the moment.