Error 3075 Filtering on a form.

Plukey

Board Regular
Joined
Apr 19, 2019
Messages
138
Office Version
  1. 2016
Platform
  1. Windows
I'm assuming its gotta be something with the data format.

VBA Code:
Private Sub cboHull_AfterUpdate()
    Requeryform
End Sub
VBA Code:
Sub Requeryform()
Dim strSQL As String
strql = ""
    If Len("" & Me!cboHull) > 0 Then
    strSQL = " [Hull_PS]= '" & Me!cboHull.Value
End If
    If Len(strSQL) = 0 Then
    Me.FilterOn = False
    Else
    Me.Filter = strSQL
    Me.Filter = True
End If

End Sub
1692050656862.png

1692050671018.png

1692050680990.png

.. possibly. The column I'm trying to filter has to be the Hull with PS. Ive tried a few different options & Im stumped.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Yes,
You start the text field with a ', but do not close it with a ' ? :(
You have to keep them in pairs. Same would apply if it was a date value and #

Debug.Print your sql strings before you use them, to ensure they at least look correct.
 
Upvote 0
Solution
Yes,
You start the text field with a ', but do not close it with a ' ? :(
You have to keep them in pairs. Same would apply if it was a date value and #

Debug.Print your sql strings before you use them, to ensure they at least look correct.
Thanks for the help...!
VBA Code:
= "[Hull] = '" & cboHull.Value & "'"
 
Upvote 0
I tend to use Me to indicate it is a control and not the field.
Also Value is the default property, so I leave that off as well. You do need it for TempVars though. :(
Code:
strSQL = "[Hull] = '" & Me.cboHull & "'"
 
Upvote 0

Forum statistics

Threads
1,223,707
Messages
6,174,000
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top