help with gromits search form

Local time
Today, 00:26
Joined
Jun 27, 2007
Messages
246
im trying to tweak gromits Search Form and, after having adjusted the code, when i run it i get a "compile error: Method or Data member not found"

Code:
Private Sub comSearch_Click()
    
    ' Update the record source
    Me.[COLOR="Yellow"]frmsubsearch[/COLOR].Form.RecordSource = "SELECT * FROM qselsearch " & BuildFilter
    
    ' Requery the subform
    Me.frmsubsearch.Requery
End Sub

I had a shaky subform at first, but I rebuilt it and thought i had done it right. Anyhow, i really dont have any idea where to begin to look for the problem, so any input is appreciated :o
 
Make sure that frmsubsearch is actually the name of the subform CONTAINER (not the subform, but the container that houses the subform on the main form). Many times the subform and subform container are named the same, which simplifies things, but if they aren't, then it will be a problem since you have to refer to the CONTAINER in the code and not the subform.

What Me.YourSubFormContainerName.Form.Recordsource actually means is that you are referring to the container on the main form and the .Form. part tells Access that you want to refer to a method or property of the subform that is housed within that container.
 
Last edited:
boblarson you are the freaking man.
 
every success presents a new failure. or should i say opportunity to learn. either way, im trying to get this to search for records Updated Before, and Updated After certain dates. the after search gives at least one record before its cutoff, and the before returns none at all.

Code:
 ' Check for min Age
    If Me.txtUAdate > "" Then
        varWhere = varWhere & "[UpdateDate] > " & Me.txtUAdate & " AND "
    End If
    
    ' Check for max Age
    If Me.txtUBdate > "" Then
        varWhere = varWhere & "[UpdateDate] < " & Me.txtUBdate & " AND "
    End If

the boxes are formatted SHORT date, and masked 99/99/0000;0;_
 
Code:
' Check for min Age
    If Me.txtUAdate > "" Then
        varWhere = varWhere & "[UpdateDate] > [color=red][b]#[/b][/color]" & Me.txtUAdate & "[color=red][b]#[/b][/color] AND "
    End If
    
    ' Check for max Age
    If Me.txtUBdate > "" Then
        varWhere = varWhere & "[UpdateDate] < [color=red][b]#[/b][/color]" & Me.txtUBdate & "[color=red][b]#[/b][/color] AND "
    End If
 

Users who are viewing this thread

Back
Top Bottom