Auto filling fields in based on values in a form

sal

Registered User.
Local time
Today, 11:58
Joined
Oct 25, 2009
Messages
52
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.
 
Last edited:
Thank you very much for the suggestion. But for some reason the same error is occurring:

Private Sub Section_AfterUpdate()
Me.RMLower = Me.Section.Column(3)
Me.RMUpper = Me.Section.Column(4)
End Sub

at .Section (this is the name of the control.
 

Users who are viewing this thread

Back
Top Bottom