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 / May 2007

Tip: Looking for answers? Try searching our database.

Control Button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wes Derhak - 07 May 2007 00:30 GMT
Hello

I need some help with a form. What I am trying to do is, to place a button
on a form in MS Access so that when you click on it, in another field it
will display a number one. If you click on the same button again it will
change the one to a two and so on.

Wes
missinglinq - 07 May 2007 00:42 GMT
Private Sub YourCommandButton_Click()
  YourTextBox = YourTextBox + 1
End Sub

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Ed Metcalfe - 07 May 2007 00:44 GMT
> Hello
>
[quoted text clipped - 4 lines]
>
> Wes

You'll need to change the button and textbox names as appropriate:

Private Sub cmdIncrement_Click()
   If Not IsNull(Me.txtSomeField.Value) Then
       Me.txtSomeField.Value = Me.txtSomeField.Value + 1
   Else
       Me.txtSomeField.Value = 1
   End If
End Sub

Ed Metcalfe.
Graham R Seach - 07 May 2007 03:36 GMT
Hi Wes,

The following will work whether the textbox is bound or unbound. Change
"cmdAdd" to the name of your button, and change "txtTextBox" to the name of
your textbox.

Private Sub cmdAdd_Click()
   Me!txtTextBox = (Me!txtTextBox, 0) + 1
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

> Hello
>
[quoted text clipped - 4 lines]
>
> Wes
Graham R Seach - 07 May 2007 10:54 GMT
Oops, sorry, I pressed the keys but the two most important characters went
missing:

Private Sub cmdAdd_Click()
   Me!txtTextBox = Nz(Me!txtTextBox, 0) + 1
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

> Hi Wes,
>
[quoted text clipped - 21 lines]
>>
>> Wes
 
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



©2009 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.