Text? All of the fields are Text fields?? Well, that does
make a difference in that the values need to be enclosed in
quotes:
If the Seq value is always two digits, you can get away
with:
DMin("SEQ", "T_DATA", "BASE='" & BASE &"' And LOT='" & LOT &
"' And Seq>'" & Seq & "'")
But if the Seq field might be any old number, then use:
DMin("SEQ", "T_DATA", "BASE='" & BASE &"' And LOT='" & LOT &
"' And Val(Seq) > " & Val(Seq))
But, even this will not work if the Seq field might contain
a non-numeric character.
--
Marsh
MVP [MS Access]
Thank you for your help Marshall, I paste your query in SQL View, removed the
carriage returns, the query follows;
SELECT BASE, LOT, SEQ,
DMin("SEQ", "T_DATA", "BASE=" & BASE &" And LOT=" & LOT & " And Seq>" & Seq)
As NEXT
FROM T_DATA
and come up with Data Type Mismatch and the following: The fields are text
data type.
BASE LOT SEQ NEXT
31892 10 10 #Error
31892 10 25 #Error
31892 10 30 #Error
31892 10 35 #Error
31892 10 40 #Error
31892 10 45 #Error
31892 11 10 #Error
31892 11 25 #Error
31892 11 30 #Error
31892 11 35 #Error
31892 11 40 #Error
31892 11 45 #Error
I'm grateful for your help.
Marshall Barton said:
shar wrote:
This is the output I get with the DMin function:
BASE LOT SEQ NEXT
31892 10 10 10
31892 10 25 10
31892 10 30 10
31892 10 35 10
31892 10 40 10
31892 10 45 10
31892 11 10 10
31892 11 25 10
31892 11 30 10
31892 11 35 10
31892 11 40 10
31892 11 45 10
Here is the SQL query:
SELECT T_DATA.BASE, T_DATA.LOT, T_DATA.SEQ, DMin("[SEQ]","T_DATA","[BASE]= "
& [BASE] And "[LOT] > " & [LOT]) AS [NEXT]
FROM T_DATA;
I seem to have missed part of the situation and gotten mixed
up over the Lot and Seq fields. Let's try this:
SELECT BASE, LOT, SEQ,
DMin("SEQ", "T_DATA", "BASE=" & BASE &
" And LOT=" & LOT & " And Seq>" & Seq) As NEXT
FROM T_DATA