473,503 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple (hopefully) question about using DMax in a query

8 New Member
Can anyone tell me why MS Access produces #Error for MaxDate in all the rows in this query?

SELECT NAMES.[Name ID], DMax("[Last Update Date]","[XREF]","[Name ID] = " & NAMES.[Name ID]) AS MaxDate
FROM [NAMES] INNER JOIN XREF ON NAMES.[Name ID] = XREF.[Name ID];

When I misspell NAMES.[Name ID], it asks me for a parameter value, so that tells me it is recognizing the criteria field syntax ok. But why no good results?

And when I enter a single, valid ID it does work. For example, "[Name ID] = 'WALKDA01'"

Thanks,
Dave
Apr 2 '08 #1
3 2114
nico5038
3,080 Recognized Expert Specialist
Can anyone tell me why MS Access produces #Error for MaxDate in all the rows in this query?

SELECT NAMES.[Name ID], DMax("[Last Update Date]","[XREF]","[Name ID] = " & NAMES.[Name ID]) AS MaxDate
FROM [NAMES] INNER JOIN XREF ON NAMES.[Name ID] = XREF.[Name ID];

When I misspell NAMES.[Name ID], it asks me for a parameter value, so that tells me it is recognizing the criteria field syntax ok. But why no good results?

Thanks,
Dave
Did you check that the [Name ID] is numeric ?
When it's a text field use:
Expand|Select|Wrap|Line Numbers
  1. SELECT NAMES.[Name ID], DMax("[Last Update Date]","[XREF]","[Name ID] = '" & NAMES.[Name ID] & "'") AS MaxDate
  2. FROM [NAMES] INNER JOIN XREF ON NAMES.[Name ID] = XREF.[Name ID];
  3.  
to add surrounding quotes.

Nic;o)
Apr 2 '08 #2
DancingDave
8 New Member
Brilliant! And such a quick response to boot! I've been struggling with this for hours. I never would have come up with that syntax on my own.

Thanks!!!!!!!!!!!!!!!!!
Apr 2 '08 #3
nico5038
3,080 Recognized Expert Specialist
Glad I could help, success with your application !

Nic;o)
Apr 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5849
by: JMCN | last post by:
is it possible to insert a value into a field when you append the new records to the table instead of appending the one new record at a time in order to insert a new value? for example, i would...
2
1576
by: Alex | last post by:
I am in need of help for a problem using Dmax to find out the cycle time of a machine which was running for an 8 hour shift "BUT" the cycle time is changing for what was on the machine for that...
3
2096
by: peddie | last post by:
Hi, I have a table that contains two key fields. I would like to assign the auto number for the secondary key field by starting from 1. For example primary Key id second Key Id...
4
1874
by: Tess2819 | last post by:
Hi Everyone, This is my first topic so I hope you can help. I have searched but can't seem to find what I am looking for, so here it is. I want to create a query using design view in...
4
2497
by: Ed Marzan | last post by:
Greetings, I have a query that returns varying prices for the same item in the following manner. Item1 Price1 Item1 Price2 Item1 Price3 Item1 Price4
3
2080
by: emalcolm_FLA | last post by:
Hello and Thanks in advance for any help. I have been tasked with rewriting a christmas assistance database using Access 2003. The old system used pre-assigned case numbers to identify...
17
2212
by: Pascal | last post by:
hello everybody ! I get this error 3 times : "The output parameter must be assigned before the control leaves the current method" (dor dMin and dMax) this one 1 time : Use of the parameter 'out'...
2
4768
by: barmatt80 | last post by:
Ran into a problem, just as I thought I had it working. Dim strCurrentFiscalYear As String strCurrentFiscalYear = DLookup("", "YearReset", " = 1") Dim strLastFiscalYear As String ...
21
4601
by: DanicaDear | last post by:
I have a report named "rptHOTSTICKS_EXPIRING" based on a query named "HOSTICKS_SHIPPING_REPORT Query". The query contains these fields: ORDER_NUM (text) CUST_NUM (text) Name, address, contact...
0
7089
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...
0
7282
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,...
0
7339
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...
0
7463
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...
0
5581
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,...
1
5017
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...
0
1515
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 ...
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.