viperpurple
Registered User.
- Local time
- Today, 07:52
- Joined
- Oct 19, 2010
- Messages
- 11
Hey,
Objective
I am creating an equipment database and this includes recording when the equipment is checked for damage etc. I have a field on the form which records when the last check was carried out.
I would like to keep this field up to date so the latest date appears whever the user view the record.
Current Plan
I currently have the equipment checks in a table and for every check the following is recorded:
check_Date, Checked_By, Equipment_Checked (memo with equipment seperated by a new line)
The 'equipment' form has a field called 'last_check' which i would like the last date to appear in. I am trying to write code to update the field when the event OnCurrent occurs for each record, the code is below but it is far off finished.
I have created a query that searches the tbl_equipment_checks table for the equipment but i'm unsure how to modify this for each seperate record, make sure the result is the most recent and then get this entered into the 'last_check' field on the form
I hope that i have given you all the information you need to help me, please don't hesitate to ask for more info.
Thanks
Adam
Objective
I am creating an equipment database and this includes recording when the equipment is checked for damage etc. I have a field on the form which records when the last check was carried out.
I would like to keep this field up to date so the latest date appears whever the user view the record.
Current Plan
I currently have the equipment checks in a table and for every check the following is recorded:
check_Date, Checked_By, Equipment_Checked (memo with equipment seperated by a new line)
The 'equipment' form has a field called 'last_check' which i would like the last date to appear in. I am trying to write code to update the field when the event OnCurrent occurs for each record, the code is below but it is far off finished.
I have created a query that searches the tbl_equipment_checks table for the equipment but i'm unsure how to modify this for each seperate record, make sure the result is the most recent and then get this entered into the 'last_check' field on the form
Code:
SELECT tbl_equipment_checks.[equipment_checked], tbl_equipment_checks.[check_by], tbl_equipment_checks.[check_date]
FROM tbl_equipment_checks;
Code:
Private Sub Form_Current()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim kit_search As String
kit_search = Me.description
Set db = CurrentDb
Set qdf = db.QueryDefs("tbl_equipment_checks_query")
qdf.Parameters("WHERE tbl_equipment_checks.equipment_checked") = kit_search
Set rs = qdf.OpenRecordset
End Sub
Thanks
Adam