Hi All,
I've been using some code in the OnClick event of a command button to make the last entered record appear in the text boxes of a new record. The txt boxes record the operators name and two other items and rather than getting them to keep selecting the same things they can just press the command button to add the last record details to the new record. Just this morning however, the command button is adding a record from two days previous and not the latest record which is what i need. My code is below if anyone can see any bugs ?
Thank you
I've been using some code in the OnClick event of a command button to make the last entered record appear in the text boxes of a new record. The txt boxes record the operators name and two other items and rather than getting them to keep selecting the same things they can just press the command button to add the last record details to the new record. Just this morning however, the command button is adding a record from two days previous and not the latest record which is what i need. My code is below if anyone can see any bugs ?
Thank you
Code:
Private Sub Refresh_Click()
If IsNull(OperatorName) Then ' Blank Field
OperatorName = DLast("OperatorName", "tbl_MainRecords")
End If
If IsNull(Plant) Then ' Blank Field
Plant = DLast("Plant", "tbl_MainRecords")
End If
If IsNull(Recipe) Then ' Blank Field
Recipe = DLast("Recipe", "tbl_MainRecords")
End If
End Sub