OutToBrunch
OutToBrunch

Reputation: 21

Form filter not updating

I have two forms PROJECT_VIEW and PROJECT_COMPANY_VIEW. The relationship between these forms is PROJECT_VIEW has a list box populated with companies. Double clicking one of these companies (see code below) will direct you to PROJECT_COMPANY_VIEW.

The issue I am having is: the companyFilter is not being updated on PROJECT_COMPANY_VIEW. As you can see, I am passing it through DoCmd.OpenForm. All of the values that appear in MsgBox are correct, including the COMPANY_ID filter. One thing to note, there are values of a company appearing in PROJECT_COMPANY_VIEW, just not the company I need.

I have tried Clearing All Filters, updating PROJECT_COMPANY_VIEW's record source, deleting the filter in PROJECT_COMPANY_VIEW then closing the form and navigating to it again.

Private Sub ProjectTenderList_DblClick(Cancel As Integer)
    Dim tenderID As Integer
    Dim companyID As Integer
    Dim companyFilter As String
    tenderID = ProjectTenderList.Column(0)
    MsgBox tenderID
    companyID = ProjectTenderList.Column(1)
    MsgBox companyID
    companyFilter = "COMPANY_ID = " & companyID
    MsgBox companyFilter
    DoCmd.OpenForm "PROJECT_COMPANY_VIEW", , companyFilter, , , , tenderID
End Sub

Thank you for your time.

Upvotes: 0

Views: 73

Answers (1)

June7
June7

Reputation: 21370

Filter criteria is in the wrong argument, needs to be the WHERE CONDITION. Move it over one comma position.

DoCmd.OpenForm "PROJECT_COMPANY_VIEW", , , companyFilter, , , tenderID

Upvotes: 1

Related Questions