Dmax

arage

Registered User.
Local time
Today, 01:17
Joined
Dec 30, 2000
Messages
537
Dmax
I’m using dmax to assign values to a text box each time I add a new record in my form. However, when I goto the next record and add the next info & save it, I notice that the text box is the same as the last record, it is not increasing by one as I specified in my vba.

Here’s what the procedure looks like that I’m using to assign the next highest number:

'provides the next event number per region and promotion type...
Private Sub nextEventNum()

Dim varNextNum As Variant
Dim strCriteria As String

'set the string criteria...
strCriteria = "regionaldirectorcode=" & glblDirCode & " and promotiontype='" & Me.PromotionType & "'"

'determine the highest event number issued...
varNextNum = DMax("eventnumber", "newquery", strCriteria)

'add 1 to the above & display it as the next event number...
Me.txtEventNumber = varNextNum + 1

End Sub
 
haha, I figured it out, one of the fields in my criteria was not being saved in order for the criteria to work.
 

Users who are viewing this thread

Back
Top Bottom