fill field with value from previous record

S. McCann

Registered User.
Local time
Today, 20:11
Joined
Nov 23, 2001
Messages
10
I have a form with fields "From" & "To". I would like to be able to have the "To" value automatically become the "From" value for each successive record.
ie: FROM To
5.0 6.5
6.5 7.0
7.0 8.1
Any help would be greatly appreciated.
 
A fairly simple way is, in the AfterUpdate event of the control, set the default for that control as its current value. Here's an example of a text box containing a numeric entry. Note that the format will change slightly if referring to text or date (examples shown).

Private Sub FacilityID_AfterUpdate()
If Not IsNull(Me.FacilityID) Then
Me.FacilityID.DefaultValue = "=" & Me.FacilityID
'Use 'For text fields 'Me.Operatorid.DefaultValue = "='" & Me.OperatorID & "'"
'For date fields 'Me.Operatorid.DefaultValue = "=#" & Me.Operatorid & "#"
'For number fields 'Me.Operatorid.DefaultValue = "=" & Me.Operatorid

Me.FacilityID.TabStop = False
Else
Me.FacilityID.TabStop = True
End If

End Sub
 
Thanks raskew. You have just made my day
smile.gif
 

Users who are viewing this thread

Back
Top Bottom