
Originally Posted by
WCStarks
I tried the DLookUp as you have it written, but it still doesn't copy the date from the child table into the main form, when I refresh the main form. I also tried it without the concatenation as: ... = Me.[Member_ID]"), and that did no better. I don't understand the logic of the concatenation. It seems to me it should all be part of the string.
Private Sub Joined_AfterUpdate()
Me.[Joined] = DLookup("[Status_Date]", "Membership", "[Status] = ""Joined"" and Members.[ID] =" & Me.[Member_ID])
End Sub
The code in the Joined_AfterUpdate event will only be called after the text in the textbox is changed by the user. It won't even be called when you cycle through the different records or refresh your form.
I wonder if your Members.[ID] and Me.[Member_ID] are not reversed? Should it be
Code:
=DLookup("[Status_Date]", "Membership", "[Status] = ""Joined"" and [Member_ID] =" & ID)
?
Anyway, just to clarify it should be DLookup("[Status_Date]", "Membership", "[Status] = ""Joined"" and [Foreign Key ID field on "subtable"] =" & [Primary Key ID Field on "main table"]) when called from the "main table".
And I would try it in the control source property of a textbox rather than in code. IE in your form's design view Right click on your Joined textbox and click "Form Properties", go to the "Data" tab, change the "Control Source" property to the DLookUp function. Don't forget the equal sign at the beginning.