Dmax Function

R

Raul Sousa

I have this code:

If [TDocumento] = 1 Then
DocID = "VD" & Year(DataF)
varMax = DMax("DocID", "FacturaVenda", "DocID like """ & DocID & "*""")
varMax = Val(Nz(Mid(varMax, 7), 0)) + 1

my database arrived at DocID VD2008999. Then, with this code, it created
DocID VD20081000.
The problem is that, Now DocID is not increasing because the Dmax Function
is always returning VD2008999. For this function VD2008999 > VD20081000.

How can I solve this situation?
 
D

Douglas J. Steele

VD2008999 IS always greater than VD20081000.

Try:

varMax = DMax("Mid(DocID, 7)", "FacturaVenda", "DocID like """ & DocID &
"*""")
 

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