J
Jacinda
The following code is used for a search screen, and it is very cool...
The table Talldocs, is created from a series of queries that pull info from
odbc tables and appends to Talldocs. The reason I create the table is because
the odbc database separates the "open orders" from the "closed orders" and
when I search I need to look for an order no matter it's status... is there a
way to simpify this process so that I can search multiple tables or sources
and put a result somewhere, like a sub datasheet form?
FYI - I can not query both the open and closed together because they don't
have anything in common.... no join.
I guess I'm trying to create more of a "google" atmosphere... so that I
won't have to create a table just to search data that is already available in
the database.
strWhere = "1=1"
'If Part Number
If Not IsNull(Me.Search) Then
'Add it to the predicate- match on leading characters
strWhere = strWhere & " AND " & "Talldocs.Order like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Partno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Custno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.CustNm like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Pono like '*" & Me.Search &
"*'"
strWhere = strWhere & " OR " & "talldocs.docno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "talldocs.status like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "talldocs.doctype like '*" &
Me.Search & "*'"
End If
If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "frmSearchResults", acFormDS, , strWhere,
acFormEdit, acWindowNormal
If Not Me.Detail.Visible Then
Me.Detail.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.Detail.Height
End If
Me.FAllResults.Form.Filter = strWhere
Me.FAllResults.Form.FilterOn = True
End If
-Jacinda
The table Talldocs, is created from a series of queries that pull info from
odbc tables and appends to Talldocs. The reason I create the table is because
the odbc database separates the "open orders" from the "closed orders" and
when I search I need to look for an order no matter it's status... is there a
way to simpify this process so that I can search multiple tables or sources
and put a result somewhere, like a sub datasheet form?
FYI - I can not query both the open and closed together because they don't
have anything in common.... no join.
I guess I'm trying to create more of a "google" atmosphere... so that I
won't have to create a table just to search data that is already available in
the database.
strWhere = "1=1"
'If Part Number
If Not IsNull(Me.Search) Then
'Add it to the predicate- match on leading characters
strWhere = strWhere & " AND " & "Talldocs.Order like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Partno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Custno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.CustNm like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "Talldocs.Pono like '*" & Me.Search &
"*'"
strWhere = strWhere & " OR " & "talldocs.docno like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "talldocs.status like '*" & Me.Search
& "*'"
strWhere = strWhere & " OR " & "talldocs.doctype like '*" &
Me.Search & "*'"
End If
If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "frmSearchResults", acFormDS, , strWhere,
acFormEdit, acWindowNormal
If Not Me.Detail.Visible Then
Me.Detail.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.Detail.Height
End If
Me.FAllResults.Form.Filter = strWhere
Me.FAllResults.Form.FilterOn = True
End If
-Jacinda