Same button code doesn’t work twice

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.
 
J

John W. Vinson

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.
 
T

Teddy

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


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top