DMIN error

C

CJ

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.
 
K

Ken Snell

Assuming that your subform controls' names are correct:

=DMin("dtmDate","qryBlockOpen","[lngBlockID]= " &
[Forms]![frmProjectMaster]![fsubCompartments]![fsubBlocks]![lngBlockID])
 
C

CJ

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/



CJ said:
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.
 
K

Ken Snell

No, what I changed in your expression was to add " characters as delimiters
for the dtmDate field name in the first argument. I did also take out the []
characters because they're not needed when your field name has no spaces and
no special characters, but leaving them in will work too.

--

Ken Snell
http://www.accessmvp.com/KDSnell/


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/



CJ said:
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.
 
G

GP George

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/



CJ said:
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.
 
C

CJ

I did notice the addition of the quotes and that is what I was referring to
in my comment.
Notice that none of MY fields have spaces or symbols....EVER.

I guess my question should have been:
Why doesn't the expression builder put " " around the fields when they MUST
be there for the function to work?

However, no worries, it's all good.
--
Thanks for taking the time!

CJ
---------------------------------------------------------
Know thyself, know thy limits....know thy newsgroups!
GP George said:
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.
 
K

Ken Snell

CJ said:
I guess my question should have been:
Why doesn't the expression builder put " " around the fields when they
MUST be there for the function to work?

Now, this *is* a good question! I wish I could provide an answer...

Only guess I'd have is that somehow you told the expression builder that the
name of the field would be provided by the value of that field, thus no "
characters as delimiters. Just a guess.

Glad that it's working for you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top