0
votes

I have one table that has purchases of material from several vendors, some as many as 50 to 100 items per vendor. I'm trying to use a split form with a combo box to select a vendor then show all records of the purchases from that vendor.

I listed the vendors in the combo box and tried a VBA code to filter the records

 Private sub cboVendors_AfterUpdate()
    Me.Filter= "[Vendors] = " & char(34) & Me.cboVendors &  char(34)
    Me.FilterOn =True
        End Sub

I'm using Access 2016 and get a: compile error Sub or function not defined If I dim char(34) I get a syntax error :

(missing Operator) in query expression[vendors] = Ace Hardware

The vendor selected. The code I used, I found on a Youtube video online that seemed to work with Access 2007. I'm expecting to get the results of the records pertaining to the vendor I select from the combo box.

1

1 Answers

0
votes

It is not char but Chr. However, try:

Me.Filter = "[Vendors] = '" & Me.cboVendors & "'"