Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2012
    Posts
    15

    Unanswered: Form/Subform Help

    I have a main form where i enter a bunch of values in text boxes and then press a command button to run a macro to populate some tables.

    I then have a subform that is running of a query that is built on one of the new populated tables and a filter on a list box on my form.

    The issue i have is that if i wanted to change the values of the text boxes in the main form and re run to macro.... i cant. as one of the tables is in use by the sub form.

    how do i get around this?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can always disconnect the subform from its RecordSource before updating the table(s), then reconnect it:

    Code:
    Private Sub Command_PopulateTable_Click()
    
        Dim strRecordSource As String
    
        With Me.SubFormControl.Form
            strRecordSource = .RecordSource
            '
            ' Call here the macro of function that populates the table(s).
            '
            .RecordSource = strRecordSource
        End With
    
    End Sub
    Where:
    -Command_PopulateTable is the name of the Command Button used to populate the table(s).
    -SubFormControl is the name of the SubForm/SubReport control.
    Have a nice day!

Posting Permissions

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