greendragon51
Technical User
Ok.... I'm a newbie at the coding stuff. But everbody had to start somewhere, right? I need to have a fields default value be the same as the previous records untill the user changes it. I have researched in these forums and found the following...
Private Sub Dept_Division_GotFocus()
;If this is a new record, default to the value
;of Dept_Division of previous record.
Dim NewRec As Integer
Dim Frm As Form
Set Frm=Screen.ActiveForm ;Set Frm to the active form.
;Is the current record a new record?
NewRec=Frm.NewRecord
If NewRec=True Then
If IsNull([Dept_Division]) Then
SendKeys("^'"
End If
End If
The above code will place the value of the last record into the field Dept_Division as soon as Dept_Division gets focus.
Thanks very much to MrBILLSC for this work. ( Dec of 01 )
Now.... just where do I insert this code to make it work?
( Access 2000, Win XP and Win98SE )
Thanks so very much for helping a new guy!
Old Guy
Private Sub Dept_Division_GotFocus()
;If this is a new record, default to the value
;of Dept_Division of previous record.
Dim NewRec As Integer
Dim Frm As Form
Set Frm=Screen.ActiveForm ;Set Frm to the active form.
;Is the current record a new record?
NewRec=Frm.NewRecord
If NewRec=True Then
If IsNull([Dept_Division]) Then
SendKeys("^'"
End If
End If
The above code will place the value of the last record into the field Dept_Division as soon as Dept_Division gets focus.
Thanks very much to MrBILLSC for this work. ( Dec of 01 )
Now.... just where do I insert this code to make it work?
( Access 2000, Win XP and Win98SE )
Thanks so very much for helping a new guy!
Old Guy