PDA

View Full Version : Autofill TextBox in From based on a text field in a subform



thelegazy
11-12-2013, 09:20 AM
Hi all,

I was hoping someone could help me with a problem I'm trying to figure out in Access.

So, I have a overall master form which inside has sub forms.
There is a subform (sfrmAgency) on the top left which is based on a query that is displaying an "Agency ID" which is based off an entered value right above it which is "Submission ID". I have the "Submission ID" in the sub form hidden, so you can only see the "Agency ID". The query is based on a table called "Submit".

The "Agency ID" that I am trying to autofill is not within a subform, but rather it is in the main form and the source of the form is from a table called "Payment". I am trying to get it so that when the "Agency ID" from sfrmAgency is populated so is the "Agency ID" in the main form.


Any help would be greatly appreciated

thelegazy
11-12-2013, 09:22 AM
I have tried to add the following code to the event, but it doesn't seem to be doing anything:

Private Sub Agency_ID_Change()
Me!Agency_ID.Text = Me!sfrmAgency!AgeAgency_ID.Text
End Sub

mrojas
11-22-2013, 05:41 AM
When referencing to an object in a subform, its syntax is as follows:
Forms![MainFormName]![SubformName].Form![SubformControlName]

In your case this would look similar to this:


Private Sub Agency_ID_Change()
Me.Agency_ID = Forms![MainForm]![sfrmAgency].Form![AgeAgency_ID]
End Sub

Leavitt55
12-09-2013, 03:45 AM
nice content and written well for a change. It's nice to see that some people still understand how to write a quality post.