Full Version: subform filter off of other subform filter
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
thomp2bl
Hello Everybody,

I have a form with two subforms on it. the form contains project info and the first subform is about invoices. projects have multiple invoices and from those invoices there are multiple drafts. so i have a project filter on the main form and from ther i have an invoice filter on the invoice form. this all works until i try to filter drafts from their particular invoice. Here is the record source stuff for the unbound draft filter:

SELECT draftnum FROM draft WHERE draft.invoicenum=forms!invoice!invoicenum;

what would be the child parent link? could that be a problem because now i have it set to invoicenum for the draft subform.

Thank you for all the help!!!

Sincerely,

Brian
thomp2bl
Here is some more info to help out. This is my code for the after update part in my draft subform vba:

CODE
Private Sub DraftNumCombo_AfterUpdate()
If Not IsNull(Me.DraftNumCombo) Then
   strWhere = strWhere & " ([draftnum] = """ & Me.DraftNumCombo & """) and "

End If

lngLen = Len(strWhere) - 5
    If lngLen <= 0 Then     'Nah: there was nothing in the string.
        MsgBox "No criteria", vbInformation, "Nothing to do."
    Else                    'Yep: there is something there, so remove the " AND " at the end.
        strWhere = Left$(strWhere, lngLen)
        'For debugging, remove the leading quote on the next line. Prints to Immediate Window (Ctrl+G).
'Debug.Print strWhere
        
        'Finally, apply the string as the form's Filter.
        Me.Filter = strWhere
        Me.FilterOn = True
    End If
End Sub
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.