On a subform, one of the fields is for recording the page
number from paper forms. I'd like the user to be able to
quickly set the default value (Integer) during data entry.
I had no trouble making Command Buttons for "Page 1", "Page
2", and "Page 3", but now the paper data is coming in with
more than 3 pages, and I'm trying to revamp the buttons to
simply have one button for "+1" and one button for "-1". But
the VBA code is giving me fits.
I've tried this:
Me.Form![sfrmIvDetail].Controls![txtPage].DefaultValue =
(Me.Form![sfrmIvDetail].Controls![txtPage].DefaultValue.Value
+ 1)
... and many variants, but can't seem to find the right
syntax.
This is Access 2002.
Any thoughts appreciated.

Signature
Thanks,
tbl
Marshall Barton - 14 Mar 2007 18:15 GMT
>On a subform, one of the fields is for recording the page
>number from paper forms. I'd like the user to be able to
[quoted text clipped - 13 lines]
>
>This is Access 2002.
Me.sfrmIvDetail.FORM.txtPage.DefaultValue = _
Val(Me.sfrmIvDetail.FORM.txtPage.DefaultValue) + 1

Signature
Marsh
MVP [MS Access]
tbl - 15 Mar 2007 18:09 GMT
>Me.sfrmIvDetail.FORM.txtPage.DefaultValue = _
> Val(Me.sfrmIvDetail.FORM.txtPage.DefaultValue) + 1
Thanks for that, Marsh--just what I needed.
Here's what I ended up with for my two buttons:
Private Sub cmdDefPageUp_Click()
Me.frmCountDetail.Form.txtPage.DefaultValue =
Val(Me.frmCountDetail.Form.txtPage.DefaultValue) + 1
Me.[frmCountDetail].SetFocus
End Sub
Private Sub cmdDefPageDn_Click()
If Me.frmCountDetail.Form.txtPage.DefaultValue > 1 Then
Me.frmCountDetail.Form.txtPage.DefaultValue =
Val(Me.frmCountDetail.Form.txtPage.DefaultValue) - 1
Me.[frmCountDetail].SetFocus
Else: Exit Sub
End If
End Sub

Signature
tbl