Discussion Locked

Default Value in Access 2000

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can anyone tell me how I can set the default value of a form field to be the value of another field on the previous record?

e.g. record 2 [start time] = record 1 [finish time], record 3 [start time] = record 2 [finish time]...and so on.

All Ihave managed to do is use the default value property but this sets it to [finish time] on the current record.

Also, how can I use the Sendkey function to send CTRL+ALT+SPACE to update the field automatically when the field is entered?

3 replies

by phingers

Thanks for your help but I managed to do it with the following code in an event procedure on the Form (I am already using a Form)

Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone

If rs.EOF Then ' don't do anything if there's no records or it is not a new record
Else
With rs
.MoveNext
Me![finish_time] = .Fields("start_time")
End With

End If

End Sub

This discussion is closed to new replies.