AnsweredAssumed Answered

VBA Display Time using Control Datepicker / Command Button Bug

Question asked by tklatt on Dec 22, 2014
Latest reply on Apr 9, 2015 by klum

Hello again i asked a question and got 99% of the functionality to work but am stuck one one last little annoying bug and would appreciate some help if anyone has the free time. I have a image attached of what the display looks like on the Pi Processbook page and will attach my code and explain the issue i am having. (my original post where i got help Setting Processbook Display time with VBA code off control datetime button)

 

Code:

Private Sub DTPicker1_Change()

    ThisDisplay.SetTimeRange Format(DTPicker1.Value - 1, "MM-dd-yyyy 06:50"), Format(DTPicker1.Value, "MM-dd-yyyy 06:50")

End Sub

 

Private Sub CommandButton1_Click()

    Dim dtmDateTime As String

    dtmDateTime = Format(Now, "MM-dd-yyyy 06:50")

    Me.DTPicker1.Value = dtmDateTime

    ThisDisplay.SetTimeRange Format(DTPicker1.Value - 1, "MM-dd-yyyy 06:50"), Format(DTPicker1.Value, "MM-dd-yyyy 06:50")

End Sub

 

I have a Microsoft Forms 2.0 CommandButton and Microsoft Data and Time Picker Control 6.0 being used in my Processbook. I also want a 0650-0650 24 hour display for the ProcessBook.


My Bug:


When a user other than my computer (Pi admin) uses the command button they do not get the desired response on the first click, if they click the button, click on the background, and then click the button again though it works flawlessly from then on for both controls. The DateTime Picker will not work with a reset of that fashion though it needs the Current Day Command button to be "reset" before it is functional.

 

Other Details:

On my computer it works properly and can load a date from either the DateTime Picker or the CommandButton without having to select something and press the command button, then unselect it, and press it again.

 

I do not mind if the solution is as simple as building in the click command button,unselect,click command button into the command button macro, just something to avoid having to. If anyone out there with a little more experience can point out my hopefully simple mistake i would appreciate it greatly.

Outcomes