Auto filling fields based on values in a form
This is one of those rare occasions where values from a related table must be stored in the main table; These are river mile start and end points that are default values but not always actual values. The purpose of this action is to bypass cascading combos and speed up data entry such that the moment the Section is entered the RM's fill.
The code I have is similar to another post except it is placed in the After_Update event of the field I wish to update from. However, my code is producing a compile error: Argument not optional. The debugger points to Me.Section:
Private Sub Section_AfterUpdate()
Me.RMLower = DLookup("[RMLower]", "[Survey Sections]", "Section_ID = '" & Me.Section & "'")
End Sub
Section_ID (a text field) is the common value in the table; Section is the control containing the related value; Survey Sections is the lookup table; and RMLower the field contains the value as well as the control to be updated.
If I could get this to work I would like to add another field, RMUpper as well, presumably as a second, nearly identical line.
This is one of those rare occasions where values from a related table must be stored in the main table; These are river mile start and end points that are default values but not always actual values. The purpose of this action is to bypass cascading combos and speed up data entry such that the moment the Section is entered the RM's fill.

The code I have is similar to another post except it is placed in the After_Update event of the field I wish to update from. However, my code is producing a compile error: Argument not optional. The debugger points to Me.Section:
Private Sub Section_AfterUpdate()
Me.RMLower = DLookup("[RMLower]", "[Survey Sections]", "Section_ID = '" & Me.Section & "'")
End Sub
Section_ID (a text field) is the common value in the table; Section is the control containing the related value; Survey Sections is the lookup table; and RMLower the field contains the value as well as the control to be updated.
If I could get this to work I would like to add another field, RMUpper as well, presumably as a second, nearly identical line.
Last edited: