filter combo box

  • Thread starter Thread starter tbotkin
  • Start date Start date
T

tbotkin

I am trying to filter a combo box on a form using a combo box. The combo box
on the form cboVendorSelect is a bound combo box. The combo box that I am
using as a filter cboVendorName is unbound. Both combo boxes contain two
fields, VendorNo and VendorName and both draw from the same row source. The
first field is the Bound Column in both combo boxes; both are hidden with
only the VendorName showing on the form. All the fields are text.

When I apply the filter I receive and error; Run-time error 2448 Can’t
assign a value to this object.

Here is the code I am using. Any suggestions?

Private Sub cboVendorname_AfterUpdate()
If Me.Dirty Then Me.Dirty = False 'Save first.
Me.Filter = "[VendorNo]"" & Me.cboVendorname& """
Me.FilterOn = True

End Sub

Thanks in advance
Tbotkin
 
It looks to me the Filter statement is malformed. I think it should be:

Me.Filter = "[VendorNo] = " & Me.cboVendorname

assuming that [VendorNo] is a numeric Field. If [VendorNo] is a Text Field,
then use:

Me.Filter = "[VendorNo] = """ & Me.cboVendorname & """"

Which line of code errored out in your test? Your code might have errored
out before the Filter statement and I don't know the context of your update
statement.
 
Thanks for the assistance, that did it.
It looks to me the Filter statement is malformed. I think it should be:

Me.Filter = "[VendorNo] = " & Me.cboVendorname

assuming that [VendorNo] is a numeric Field. If [VendorNo] is a Text Field,
then use:

Me.Filter = "[VendorNo] = """ & Me.cboVendorname & """"

Which line of code errored out in your test? Your code might have errored
out before the Filter statement and I don't know the context of your update
statement.
I am trying to filter a combo box on a form using a combo box. The combo
box
[quoted text clipped - 19 lines]
Thanks in advance
Tbotkin
 
Back
Top