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 / January 2005

Tip: Looking for answers? Try searching our database.

User scroll dates question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wylie C - 30 Jan 2005 16:49 GMT
I have a date control that when the form loads displays the current date.
What code/process do I need to do so when the user hits the + or - key the
date changes?

Thanks
Paul Overway - 30 Jan 2005 17:10 GMT
Make a Public Function for this:

Function ChangeDate(KeyAscii As Integer, ActiveControl As Control) As
Integer

   Select Case KeyAscii
       Case 43
           If IsDate(ActiveControl) Then
               ActiveControl = ActiveControl + 1
           Else
               ActiveControl = Date()
           End If

           ChangeDate = 0
       Case 45
           If IsDate(ActiveControl) Then
               ActiveControl = ActiveControl - 1
           Else
               ActiveControl = Date()
           End If

           ChangeDate = 0
       Case Else
           ChangeDate = KeyAscii
   End Select

End Function

Then, you'd use the function in any KeyPress event like this:

   KeyAscii = ChangeDate(KeyAscii,Me.ActiveControl)

Signature

Paul Overway
Logico Solutions
http://www.logico-solutions.com

>I have a date control that when the form loads displays the current date.
> What code/process do I need to do so when the user hits the + or - key the
> date changes?
>
> Thanks
 
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.