Consulting

Results 1 to 4 of 4

Thread: Autofill TextBox in From based on a text field in a subform

  1. #1

    Autofill TextBox in From based on a text field in a subform

    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

  2. #2
    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

  3. #3
    VBAX Contributor
    Joined
    Oct 2011
    Location
    Concord, California
    Posts
    101
    Location
    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

  4. #4
    nice content and written well for a change. It's nice to see that some people still understand how to write a quality post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •