B
BrettS
Hi,
I am trying to get some data entry forms to do an automatic sequence of ID
#'s as users input records, based on the ID #'s already in the table. I
found some basic code through a search here to do basically that:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
If RecordsetClone.RecordCount = 0 Then
Me.[Sample #] = 1
Else
Me.[Sample #] = DMax("[Sample #]", "Samp Data") + 1
End If
End If
End Sub
However I need to add something extra. I have these Samples in this table
filtered by [RE Job #], so instead of simply picking the DMax value for all
[Sample #] in the "Samp Data" table, I want it to pick the DMax for just the
[Sample #]s whose [RE Job #] value match the value in this field on a
seperate form (which will always be open), [Forms]![TaskData]![RE Job #].
Does anyone have any idea how to incorporate this filter into the code?
Thanks for any help.
I am trying to get some data entry forms to do an automatic sequence of ID
#'s as users input records, based on the ID #'s already in the table. I
found some basic code through a search here to do basically that:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
If RecordsetClone.RecordCount = 0 Then
Me.[Sample #] = 1
Else
Me.[Sample #] = DMax("[Sample #]", "Samp Data") + 1
End If
End If
End Sub
However I need to add something extra. I have these Samples in this table
filtered by [RE Job #], so instead of simply picking the DMax value for all
[Sample #] in the "Samp Data" table, I want it to pick the DMax for just the
[Sample #]s whose [RE Job #] value match the value in this field on a
seperate form (which will always be open), [Forms]![TaskData]![RE Job #].
Does anyone have any idea how to incorporate this filter into the code?
Thanks for any help.