Full Version: Command Button To Add Time
UtterAccess Discussion Forums > Microsoft® Access > Access Date + Time
MelMiddleton
I have a command button I created with On click focus expression reads:
Private Sub Command27_Click()
Me!TimeIn = Now()
End Sub

But when I click it, nothing happens? What am I doing wrong?
Aquadevel

What is the control on the form to hold the time?
MelMiddleton
I have a text box linked to my time card table. Text box is named LbTimeIN

Tinkering with the code it now says

Private Sub CmdTimeIN_Click()
Me.TimeIn = Now()
End Sub
arul
It works fine for me...


Private Sub Command0_Click()
Me.TimeIn = Now()
Form_test.TimerInterval = 1000
End Sub


Private Sub Form_Timer()
Me.TimeIn = Now()
Form_test.TimerInterval = 1000
End Sub
MelMiddleton
Im confused by the second set of codes?

Private Sub Command0_Click()
Me.TimeIn = Now()

Form_test.TimerInterval = 1000
End Sub


Private Sub Form_Timer()
Me.TimeIn = Now()
Form_test.TimerInterval = 1000
End Sub


I have tried this every way I can think i have no idea why it wont work. . . any help anyone can offer please?
MelMiddleton
QUOTE (arul @ Oct 30 2011, 08:23 PM) *
It works fine for me...


Private Sub Command0_Click()
Me.TimeIn = Now()
Form_test.TimerInterval = 1000
End Sub


Private Sub Form_Timer()
Me.TimeIn = Now()
Form_test.TimerInterval = 1000
End Sub

------------------------------------------------------

like this?

Private Sub CmdTimeIn_Click()
Me.TimeIn = Now()
FRMInpute = 1000
End Sub


Private Sub FRMInput()
Me.TimeIn = Now()
FRMInpute.TimerInterval = 1000
End Sub
MelMiddleton
or this

Private Sub CmdTimeIn_Click()
Me!TimeIn = Now()
FRMInpute.TimeIn = 1000
End Sub
arul
Yes.... is it not working ?? I hope I got it right (your issue). Please find the sample database attached.

MelMiddleton
Still not working. . . see my attached
arul
sorry mate... i have Office 2003 installed on my computer
MelMiddleton
I see that I had the code wrong I have it as

Private Sub CmdTimeIn_Click()
Me.TimeIn = Now()
FRMInput.TimerInterval = 1000
End Sub
Private Sub Form_Timer()
Me.TimeIn = Now()
FRMInput.TimerInterval = 1000
End Sub

still a no go
MelMiddleton
ok progress, no if I click the button then the text box I get the time?
MelMiddleton
I got it! Phew! thank you sooooooo much
arul
yes.... on button click the text box shows the current time; keep refreshing every one second to give the updated time.
arul
yw.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.