Same button code doesn’t work twice

  • Thread starter Thread starter Teddy
  • Start date Start date
T

Teddy

I have two fields in a form Start and Finish. I put a command button next to
each field in design view.

I put this code into the start button

Private Sub Command12_Click()
Me!Start = Now()
End Sub


I put this code into the finish button

Private Sub Command14_Click()
Me!Start = Now()
End Sub

However, only the start button works, do you know what I might be doing
wrong and how I can fix it?

Thank you for your time.
 
I have two fields in a form Start and Finish. I put a command button next to
each field in design view.

I put this code into the start button

Private Sub Command12_Click()
Me!Start = Now()
End Sub


I put this code into the finish button

Private Sub Command14_Click()
Me!Start = Now()
End Sub

However, only the start button works, do you know what I might be doing
wrong and how I can fix it?

Thank you for your time.

The finish button is setting the value of Start. Don't you want it to set the
value of Finish instead?

Note that the buttons might not be necessary; if you're recording the start
and finish times of data entry into the form, you can put

Me.Start = Now()

in the Form's BeforeInsert event, and

Me.Finish = Now()

in its Beforeupdate event.
 
Thanks for pointing that out.

ruralguy via AccessMonster.com said:
Both buttons do the same thing!


--
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com


.
 
Back
Top