I am trying to create multiple subforms in a form that are grouped by a part number, based on multiple passthru queries. I know that ACCESS does not allow you to do this with the parent child realationship of subforms, but I am trying to figure out how to accomplish this via code. I found this snippet of code written by datAdrenaline on the utter access forums but cant seem to get it to work
Private Sub Form_Current()
If Not Me.NewRecord Then
CurrentDb.QueryDefs("<name of your passthru>").SQL = "SELECT * FROM <table owner>.<table name>" & _
" WHERE <link child field name> = " & Me.<name of master field/control>
With Me.<name of sub from control>.Form
.RecordSource = .RecordSource ' .. or the name of your passthru
End With
End If
Does anyone know if this goes in a module or somewhere in the form or subforms event procedure?
Private Sub Form_Current()
If Not Me.NewRecord Then
CurrentDb.QueryDefs("<name of your passthru>").SQL = "SELECT * FROM <table owner>.<table name>" & _
" WHERE <link child field name> = " & Me.<name of master field/control>
With Me.<name of sub from control>.Form
.RecordSource = .RecordSource ' .. or the name of your passthru
End With
End If
Does anyone know if this goes in a module or somewhere in the form or subforms event procedure?