Adam McReynolds
Registered User.
- Local time
- Today, 05:21
- Joined
- Aug 6, 2012
- Messages
- 129
My question is which method of finding the last record is best, QueryDef or Recordset, and can someone point me in the right direction? Here is my data:
Table:
tbl_module_repairs
Field:
aps_rma
Textbox to insert last record RMA into:
txt_test
Here is some code I tried but get an invalid argument msgbox:
Any help would be awesome.
Table:
tbl_module_repairs
Field:
aps_rma
Textbox to insert last record RMA into:
txt_test
Here is some code I tried but get an invalid argument msgbox:
Code:
'''''''''''''''''''''''''''''''''
'Opens last RMA into textbox (For opening tag sheet)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
'Get the database and Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tbl_module_repairs")
'Search for the first matching record
rst.FindLast "[APS_RMA]"
Me.txt_test = RS!APS_RMA
'Check the result
If rst.NoMatch Then
MsgBox "Record not found."
GoTo Cleanup
End If
Cleanup:
rst.Close
Set rst = Nothing
Set dbs = Nothing
Any help would be awesome.