I have a table (tblWorkRequest)with the following fields ID (PK), WorkOrderNo, RequestDate, RequestedBy, Location, Description, AssignedTo, ScheduledCompletionDate, and ActualCompletionDate.
I have two forms (frmWorkRequest and frmAssignWorkRequest).
frmWorkRequest has the follow fields txtWorkOrderNo, txtRequestDate, txtRequestedBy, txtLocation and txtDescription.
frmAssignWorkRequest has the following fields cboWorkOrderNo, txtRequestDate, txtRequestedBy, txtLocation, txtDescription, txtAssignedTo, txtScheduledCompletionDate and txtActualCompletionDate.
I want a user to be able to choose from the cboWorkOrderNo list on the AssignWorkRequest form and that the follow fields would populate txtRequestDate, txtRequestedBy, txtLocation, txtDescription and then they would enter information into the other boxes and it would be added to that record in the WorkRequest table.
This is the code I have so far.
Expand|Select|Wrap|Line Numbers
- Private Sub cboWorkOrderNo_AfterUpdate()
- txtRequestDate = DLookup("RequestDate", "WorkRequest", "WorkOrderNo = " & Me.cboWorkOrderNo)
- txtRequestedBY = DLookup("RequestedBy", "WorkRequest", "WorkOrderNo = " & Me.cboWorkOrderNo)
- txtLocation = DLookup("Location", "WorkRequest", "WorkOrderNo = " & Me.cboWorkOrderNo)
- txtDescriptionOfWork = DLookup("DescriptionOfWork", "WorkRequest", "WorkOrderNo = " & Me.cboWorkOrderNo)
- End Sub