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