Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

User Setable Default Value for Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tbl - 14 Mar 2007 17:21 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
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.