Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TROUBLE MAKING A SEARCH FORM

Status
Not open for further replies.

JARE

Technical User
Jul 27, 2000
50
0
0
US
I am trying to create a form to apply filters on a
subform but I keep getting the error
"438 OBJECT DOESN"T SUPPORT THIS PROPERTY OR METHOD"
This is the code that I have attached to the ON_ENTER
event

Dim STRSQL As String
STRSQL = "Select * from ORDER_PROCESSING where"
STRSQL = STRSQL & " ORDER_= LIKE *" & Me!ORDER_SEARCH & "*"
Forms.SEARCH_FORM_SUBFORM.SEARCH_FORM.RecordSource = STRSQL


SEARCH_FORM IS MAIN FORM
SEARCH_FORM_SUBFORM IS SUBFORM
ORDER_SEARCH IS TEXT BOX



 
change:
Forms.SEARCH_FORM_SUBFORM.SEARCH_FORM.RecordSource = STRSQL

to:
Forms.SEARCH_FORM_SUBFORM.SEARCH_FORM.Form.RecordSource = STRSQL

HTH

PsychPt@Hotmail.com
 
As a direct answer to the question try...

Me.SEARCH_FORM_SUBFORM.Form.RecordSource = ....

You're going to have to requery the subform too.
i'd also put the rec source change in the after_update event of the ORDER_SEARCH control.

But... as is often the case I'm doing a similar thing in my DB. Just for something to think about... what i did was have a query as the source to the subform and then i set the filter of my subform in the after update event of the various controls like... may not work for you then again.

this is stripped down main form code that makes a filter for the subform.
Code:
Option Compare Database
Option Explicit

Private Sub Form_Load()
    Me.PayeeID = Null
    Me.Function = Null
    filterHist
End Sub

Private Sub Function_AfterUpdate()
    filterHist
End Sub

Private Sub PayeeID_AfterUpdate()
    filterHist
End Sub

Private Sub filterHist()
    Dim filterStr As String
    
    filterStr = ""
    If Nz(Me.PayeeID, 0) Then filterStr = filterStr & "[PayeeID]=" & Me.PayeeID
    If Nz(Me.Function, &quot;&quot;) <> &quot;&quot; Then
        If filterStr <> &quot;&quot; Then filterStr = filterStr & &quot; AND &quot;
        filterStr = filterStr & &quot;[Func]='&quot; & Me.Function.Column(2) & &quot;'&quot;
    End If
    
    Me.hist.Form.Filter = filterStr
    Me.hist.Form.FilterOn = True
End Sub

looks prettier on in the editor.

for others: The reason I'm using a subform here is b/c there's an Ms. Access bug that blanks the header controls at odd times upon a reFilter. (Thanks Rick for finding that out)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top