DMax() stands for Domain Max. It's a Domain Aggregate function. You can specify the domain (including the criteria) within which it is aggregating.
Max() simply aggregates across the domain already specified. It's used in various different situations and always refers to that situation exclusively. On a form it refers to the Max found within a specified control (not field I believe) on that form. It can be referenced in a control formula, but I'm not sure it can be within the VBA.
I know you have a table :
Table=[Project_Draw] - Field Type Index
-
Project_ID Number Composite PK
-
Sequence Number Composite PK
-
...
I assume you also have a controls called [Project_ID] and [Sequence] on the form in your SubForm control. Read that last bit carefully. It is how sub-forms work. The main form has a SubForm control, within which is held a form. I suggest for your form's (that is the form within the SubForm control) AfterUpdate event some code similar to the following :
- Private Sub Form_AfterUpdate()
-
With Me
-
.Sequence.Default = DMax(Expr:="[Sequence]", _
-
Domain:="[Project_Draw]", _
-
Criteria:="[Project_ID]=" & .Project_ID) + 1
-
End With
-
End Sub