Need Help with a MOD (1 Viewer)

jtdvet84

New member
Local time
Today, 12:38
Joined
Dec 16, 2015
Messages
2
Hi everyone,

So Some one helped me hevely with the original mod That I am tring to alter work with hear. I want it to do the same thing as the originol just on a difrint field and work with diffrint forms in the same database. I have set up a new form to search from called Categorysearch and a new form to open it in called frmcategory. Here is what I have changed. CategoryT is the list for the Main Form

Public Function TestFilter() As Byte

Dim ctl2 As Control
Dim strWhere2 As String

For Each ctl2 In Forms!Categorysearch.Form
If ctl2.ControlType = acCheckBox Then
If ctl2.Value = True Then
strWhere2 = strWhere2 & "'" & ctl2.Controls(0).Caption & "',"
End If
End If
Next

If strWhere2 > "" Then
Forms!Categorysearch.txtCounties = "Lookup_Category.CategoryT In(" & strWhere2 & ")"

Else
Forms!Categorysearch.txtCategory = Null

End If

End Function

I dont know what I am doing wrong. If you could help me out and explain it that would be much appreciated so that I can learn from my mistakes.
 

ozinm

Human Coffee Siphon
Local time
Today, 20:38
Joined
Jul 10, 2003
Messages
121
Hi,
I'm not sure why this was set up as a function as it doesn't return a value.
However, it looks like it's supposed to step through all the checkboxes in the form.
If any are ticked it grabs the caption from the checkbox and adds it to a list of values to search for.

What's the error message your getting?
 

jtdvet84

New member
Local time
Today, 12:38
Joined
Dec 16, 2015
Messages
2
So it is not giving me an error messige as much a when the form opens up it opens with one record showing. when I open the form on my own it opens fine like I want it but not sorted.
 

ozinm

Human Coffee Siphon
Local time
Today, 20:38
Joined
Jul 10, 2003
Messages
121
Sorry, not quite sure what you mean.
However, have a look at the properties of the form in design the view.
There's a setting in there to define the order.
Off the top of my head I think it's called "Order By".
 

Users who are viewing this thread

Top Bottom