D
DataDiva via AccessMonster.com
I have a form where most of the fields in a new record are auto populated
with the previous record's information. I have used this code in the On
Current event of the form:
Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone
If rs.EOF Or Not Me.NewRecord Then
' Don’t do anything if there's no records or it is not a new record
Else
With rs
.MoveLast
Me![JobNumber] = .Fields("Job_Number")
Me![cboDepartments] = .Fields("Department")
Me![InspectorID] = .Fields("Inspector_ID")
Me![PrevOperator] = .Fields("Previous_Operator")
Me![JobFunction] = .Fields("Job_Function")
Me![Process] = .Fields("Process")
End With
End If
End Sub
The code is working fine. I know someone will ask "why" I want to store
redundant data so I will just get that answer out of the way Auto
populating makes the users job a lot easier because they will only be working
on one Job at a time, which means that most of the information should be the
same with the exception of the Serial_Number and if there are Defects_Present.
My question is when a user is ready to move to different Job Number with a
new set of information, is there a way to create a button (or something to
that effect) that gives you a new blank record without populating any of the
previous info? I hope this makes some sense! Thank you in advance for any
help that is offered!
Courtney
with the previous record's information. I have used this code in the On
Current event of the form:
Private Sub Form_Current()
Dim rs As Object
Set rs = Me.Recordset.Clone
If rs.EOF Or Not Me.NewRecord Then
' Don’t do anything if there's no records or it is not a new record
Else
With rs
.MoveLast
Me![JobNumber] = .Fields("Job_Number")
Me![cboDepartments] = .Fields("Department")
Me![InspectorID] = .Fields("Inspector_ID")
Me![PrevOperator] = .Fields("Previous_Operator")
Me![JobFunction] = .Fields("Job_Function")
Me![Process] = .Fields("Process")
End With
End If
End Sub
The code is working fine. I know someone will ask "why" I want to store
redundant data so I will just get that answer out of the way Auto
populating makes the users job a lot easier because they will only be working
on one Job at a time, which means that most of the information should be the
same with the exception of the Serial_Number and if there are Defects_Present.
My question is when a user is ready to move to different Job Number with a
new set of information, is there a way to create a button (or something to
that effect) that gives you a new blank record without populating any of the
previous info? I hope this makes some sense! Thank you in advance for any
help that is offered!
Courtney