By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

Changing Hour/Min/AM-PM

P: n/a
I have a textbox for Hour, a textbox for Minute, a textbox for AM/PM and an up
button and down button to increment/decrement the values in the textboxes. I
have the code to increment/decrement all three, what I need is a way to tell the
buttons which textbox to increment/decrement. Can anyone help.

Thanks!

Mark

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Mark,

Suppose you click on the Hour textbox and then on the Up button. The
button takes the focus from the textbox, but Screen.PreviousControl
still points to it. Try something like this (untested air code) in the
beginning of the buttons' Click() event procedures:

Dim ctlC As Control

Set ctlC = Screen.PreviousControl
ctlC.SetFocus
Select Case ctlC.Name
Case "txtHour", "txtMinute"
'code here to increment or decrement
With ctlC

End With
Case "txtAMPM"
'code to change from AM to PM or vice versa
With ctlC

End With
Case Else
'button was pressed when some other control
'had focus: do nothing
End Select
Set ctlC = Nothing

On Tue, 06 Jan 2004 05:07:42 GMT, "Mark" <mm*****@earthlink.net> wrote:
I have a textbox for Hour, a textbox for Minute, a textbox for AM/PM and an up
button and down button to increment/decrement the values in the textboxes. I
have the code to increment/decrement all three, what I need is a way to tell the
buttons which textbox to increment/decrement. Can anyone help.

Thanks!

Mark


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.