T
tbl
On a data-entry subform, there are two fields involved:
"PageNumber" (Integer) and "LineNumber" (Integer).
I've managed to get buttons on the main form to nudge the
PageNumber DefaultValue up or down by one, and that seems to
be working well enough.
I can get the LineNumber DefaultValue to ratchet up one, by
putting some code (using DMax) in the subform's OnCurrent
event.
But what I need is for the DMax's Where statement to filter
for the maximum stored PageNumber as well as
mainform/subform link. I just can't seem to get this to
work:
Dim strWherePage As String
Dim strWhere As String
Dim PageMax As String
If Me.Parent.NewRecord Then
Me![txtLine].DefaultValue = 1
Else
strWhere = "[CountId] = " & Me.Parent![CountId] And
"[Page] = " & Me![txtPage].DefaultValue
Me![txtLine].DefaultValue = Nz(DMax("CountLine",
"tblCountDetail", strWhere), 0) + 1
End If
Any help appreciated.
"PageNumber" (Integer) and "LineNumber" (Integer).
I've managed to get buttons on the main form to nudge the
PageNumber DefaultValue up or down by one, and that seems to
be working well enough.
I can get the LineNumber DefaultValue to ratchet up one, by
putting some code (using DMax) in the subform's OnCurrent
event.
But what I need is for the DMax's Where statement to filter
for the maximum stored PageNumber as well as
mainform/subform link. I just can't seem to get this to
work:
Dim strWherePage As String
Dim strWhere As String
Dim PageMax As String
If Me.Parent.NewRecord Then
Me![txtLine].DefaultValue = 1
Else
strWhere = "[CountId] = " & Me.Parent![CountId] And
"[Page] = " & Me![txtPage].DefaultValue
Me![txtLine].DefaultValue = Nz(DMax("CountLine",
"tblCountDetail", strWhere), 0) + 1
End If
Any help appreciated.