3075 Error Trying to search for key word in a comments field.

OK so here is where I am and what I am trying to do next.

Where I am.
I have my Visual Basic code tied into the OK command button.  I have a Form 
to search through my data and only put the requested information in a query.  
So far I have all of this working fine.  I have the code clear the query each 
time it is used and repopulate the querry with the new choices.(The Where 
From etc...)

The Problem with what I am trying to do next.  
It has been decided that there needs to be a comments column.  They then 
what the option to search for a key word in the column to define the results. 
 The other problem is that the comments field has no specific order of info 
in it.  This means while multiple rows have the same info in the comments 
field each row could have a different was of saying it.
Example
  Laser Cut, Production
  Production, Laser Cut

So here is it.
In visual basic I need to be able to do the following:
Leave Field blank (so not to limit results)
Input a key word to limit results


Thank you,
Swordsman8
If you have question just let me know.

0
Utf
8/27/2007 3:32:04 PM
access 16762 articles. 3 followers. Follow

5 Replies
698 Views

Similar Articles

[PageSpeed] 19

Swordsman,

How I would handle this would depend on whether you want to be able to 
search for a single word, or for multiple key words at the same time.

1.  If you want to filter for a single key word, I would recommend putting a 
textbox in the forms header or footer, along with command buttons to filter 
and clear the filter.  Using this technique, you would type the keyword in 
the text box, and add some code in the click event of the Filter command 
button, something like:

Private sub cmd_Filter_Click

     me.filter = "[CommentField] Like '*'" & me.txt_Filter & "'*'"
     me.FilterOn = True

end sub

Private sub cmd_FilterClear_Click

    me.filter = ""
    me.filterOn = false

end sub

2.  If you want to filter on multiple words, what I have done in the past is 
something similar to above, but you have to parse the textbox contents first. 
 It might look something like:

Private Sub cmd_Filter_Click()

   Dim A() As String
   Dim intLoop As Integer
   Dim varFilter As Variant
   
   A = Split(Me.txt_Filter, " ")
   
   varFilter = Null
   For intLoop = LBound(A) To UBound(A)
      varFilter = (varFilter + " AND ") _
                & "[CommentField] Like '*'" & A(intLoop) & "'*'"
   Next

   If Len(varFilter & "") = 0 Then
      Me.Filter = ""
      Me.FilterOn = False
   Else
      Me.Filter = varFilter
      Me.FilterOn = True
   End If
   
End Sub

HTH
Dale
-- 
Email address is not valid.
Please reply to newsgroup only.


"swordsman8" wrote:

> OK so here is where I am and what I am trying to do next.
> 
> Where I am.
> I have my Visual Basic code tied into the OK command button.  I have a Form 
> to search through my data and only put the requested information in a query.  
> So far I have all of this working fine.  I have the code clear the query each 
> time it is used and repopulate the querry with the new choices.(The Where 
> From etc...)
> 
> The Problem with what I am trying to do next.  
> It has been decided that there needs to be a comments column.  They then 
> what the option to search for a key word in the column to define the results. 
>  The other problem is that the comments field has no specific order of info 
> in it.  This means while multiple rows have the same info in the comments 
> field each row could have a different was of saying it.
> Example
>   Laser Cut, Production
>   Production, Laser Cut
> 
> So here is it.
> In visual basic I need to be able to do the following:
> Leave Field blank (so not to limit results)
> Input a key word to limit results
> 
> 
> Thank you,
> Swordsman8
> If you have question just let me know.
> 
0
Utf
8/27/2007 4:46:02 PM
Hello Dale,

I am needing a little more help.  I see what you are saying but I do not 
think I can do correctly from what I have so here we go.

Field Name: Comments
Form Name: frmSelectSeals

I think the problem is either I am not setting up the filter properly or it 
is because of the way I have the rest of my code writen.  Part of what the 
code does is make the SQL string placed in the querry.  This deletes the last 
search criteria and makes the new one the SQL string.

Could you please explain to me how to have it work properly.

I am getting better at writing the code but I a still a novice.

Thank you,
Swordsman8

On my OK button (used when you have made all of your selection) I have all 
of my code writen in the button on click command.  What it does it delete the 

"Dale Fye" wrote:

> Swordsman,
> 
> How I would handle this would depend on whether you want to be able to 
> search for a single word, or for multiple key words at the same time.
> 
> 1.  If you want to filter for a single key word, I would recommend putting a 
> textbox in the forms header or footer, along with command buttons to filter 
> and clear the filter.  Using this technique, you would type the keyword in 
> the text box, and add some code in the click event of the Filter command 
> button, something like:
> 
> Private sub cmd_Filter_Click
> 
>      me.filter = "[CommentField] Like '*'" & me.txt_Filter & "'*'"
>      me.FilterOn = True
> 
> end sub
> 
> Private sub cmd_FilterClear_Click
> 
>     me.filter = ""
>     me.filterOn = false
> 
> end sub
> 
> 2.  If you want to filter on multiple words, what I have done in the past is 
> something similar to above, but you have to parse the textbox contents first. 
>  It might look something like:
> 
> Private Sub cmd_Filter_Click()
> 
>    Dim A() As String
>    Dim intLoop As Integer
>    Dim varFilter As Variant
>    
>    A = Split(Me.txt_Filter, " ")
>    
>    varFilter = Null
>    For intLoop = LBound(A) To UBound(A)
>       varFilter = (varFilter + " AND ") _
>                 & "[CommentField] Like '*'" & A(intLoop) & "'*'"
>    Next
> 
>    If Len(varFilter & "") = 0 Then
>       Me.Filter = ""
>       Me.FilterOn = False
>    Else
>       Me.Filter = varFilter
>       Me.FilterOn = True
>    End If
>    
> End Sub
> 
> HTH
> Dale
> -- 
> Email address is not valid.
> Please reply to newsgroup only.
> 
> 
> "swordsman8" wrote:
> 
> > OK so here is where I am and what I am trying to do next.
> > 
> > Where I am.
> > I have my Visual Basic code tied into the OK command button.  I have a Form 
> > to search through my data and only put the requested information in a query.  
> > So far I have all of this working fine.  I have the code clear the query each 
> > time it is used and repopulate the querry with the new choices.(The Where 
> > From etc...)
> > 
> > The Problem with what I am trying to do next.  
> > It has been decided that there needs to be a comments column.  They then 
> > what the option to search for a key word in the column to define the results. 
> >  The other problem is that the comments field has no specific order of info 
> > in it.  This means while multiple rows have the same info in the comments 
> > field each row could have a different was of saying it.
> > Example
> >   Laser Cut, Production
> >   Production, Laser Cut
> > 
> > So here is it.
> > In visual basic I need to be able to do the following:
> > Leave Field blank (so not to limit results)
> > Input a key word to limit results
> > 
> > 
> > Thank you,
> > Swordsman8
> > If you have question just let me know.
> > 
0
Utf
8/27/2007 6:26:06 PM
Post the code you think is causing the problem, and I'll take a look at it.
-- 
Email address is not valid.
Please reply to newsgroup only.


"swordsman8" wrote:

> Hello Dale,
> 
> I am needing a little more help.  I see what you are saying but I do not 
> think I can do correctly from what I have so here we go.
> 
> Field Name: Comments
> Form Name: frmSelectSeals
> 
> I think the problem is either I am not setting up the filter properly or it 
> is because of the way I have the rest of my code writen.  Part of what the 
> code does is make the SQL string placed in the querry.  This deletes the last 
> search criteria and makes the new one the SQL string.
> 
> Could you please explain to me how to have it work properly.
> 
> I am getting better at writing the code but I a still a novice.
> 
> Thank you,
> Swordsman8
> 
> On my OK button (used when you have made all of your selection) I have all 
> of my code writen in the button on click command.  What it does it delete the 
> 
> "Dale Fye" wrote:
> 
> > Swordsman,
> > 
> > How I would handle this would depend on whether you want to be able to 
> > search for a single word, or for multiple key words at the same time.
> > 
> > 1.  If you want to filter for a single key word, I would recommend putting a 
> > textbox in the forms header or footer, along with command buttons to filter 
> > and clear the filter.  Using this technique, you would type the keyword in 
> > the text box, and add some code in the click event of the Filter command 
> > button, something like:
> > 
> > Private sub cmd_Filter_Click
> > 
> >      me.filter = "[CommentField] Like '*'" & me.txt_Filter & "'*'"
> >      me.FilterOn = True
> > 
> > end sub
> > 
> > Private sub cmd_FilterClear_Click
> > 
> >     me.filter = ""
> >     me.filterOn = false
> > 
> > end sub
> > 
> > 2.  If you want to filter on multiple words, what I have done in the past is 
> > something similar to above, but you have to parse the textbox contents first. 
> >  It might look something like:
> > 
> > Private Sub cmd_Filter_Click()
> > 
> >    Dim A() As String
> >    Dim intLoop As Integer
> >    Dim varFilter As Variant
> >    
> >    A = Split(Me.txt_Filter, " ")
> >    
> >    varFilter = Null
> >    For intLoop = LBound(A) To UBound(A)
> >       varFilter = (varFilter + " AND ") _
> >                 & "[CommentField] Like '*'" & A(intLoop) & "'*'"
> >    Next
> > 
> >    If Len(varFilter & "") = 0 Then
> >       Me.Filter = ""
> >       Me.FilterOn = False
> >    Else
> >       Me.Filter = varFilter
> >       Me.FilterOn = True
> >    End If
> >    
> > End Sub
> > 
> > HTH
> > Dale
> > -- 
> > Email address is not valid.
> > Please reply to newsgroup only.
> > 
> > 
> > "swordsman8" wrote:
> > 
> > > OK so here is where I am and what I am trying to do next.
> > > 
> > > Where I am.
> > > I have my Visual Basic code tied into the OK command button.  I have a Form 
> > > to search through my data and only put the requested information in a query.  
> > > So far I have all of this working fine.  I have the code clear the query each 
> > > time it is used and repopulate the querry with the new choices.(The Where 
> > > From etc...)
> > > 
> > > The Problem with what I am trying to do next.  
> > > It has been decided that there needs to be a comments column.  They then 
> > > what the option to search for a key word in the column to define the results. 
> > >  The other problem is that the comments field has no specific order of info 
> > > in it.  This means while multiple rows have the same info in the comments 
> > > field each row could have a different was of saying it.
> > > Example
> > >   Laser Cut, Production
> > >   Production, Laser Cut
> > > 
> > > So here is it.
> > > In visual basic I need to be able to do the following:
> > > Leave Field blank (so not to limit results)
> > > Input a key word to limit results
> > > 
> > > 
> > > Thank you,
> > > Swordsman8
> > > If you have question just let me know.
> > > 
0
Utf
8/28/2007 12:08:04 PM
Hello,

Here is the code for my OK command.

It does not contain anything about the comments field.  I thought you could 
put in what is needed.

Thank you,
Swordsman8


Private Sub cmdOk_Click()
    
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String


Set db = CurrentDb()
Set qdf = db.QueryDefs("SortedSeals")

If Me.listMfg.ItemsSelected.Count > 0 Then
    For Each varItem In Me.listMfg.ItemsSelected
    strCriteria = strCriteria & ",'" & Me.listMfg.ItemData(varItem) & "'"
    Next varItem
    strCriteria = Right(strCriteria, Len(strCriteria) - 1)
Else
    strCriteria = "NewTable.MFG Like ' * ' "
End If

Dim varItem2 As Variant
Dim strCriteria2 As String

If Me.listProcess.ItemsSelected.Count > 0 Then
    For Each varItem2 In Me.listProcess.ItemsSelected
    strCriteria2 = strCriteria2 & ",'" & Me.listProcess.ItemData(varItem2) & 
"'"
    Next varItem2
    strCriteria2 = Right(strCriteria2, Len(strCriteria2) - 1)
Else
    strCriteria2 = "NewTable.Process Like ' * ' "
End If


Dim varItem3 As Variant
Dim strCriteria3 As String

If Me.listCast.ItemsSelected.Count > 0 Then
    For Each varItem3 In Me.listCast.ItemsSelected
    strCriteria3 = strCriteria3 & ",'" & Me.listCast.ItemData(varItem3) & "'"
    Next varItem3
    strCriteria3 = Right(strCriteria3, Len(strCriteria3) - 1)
Else
    strCriteria3 = "NewTable.Cast Like ' * ' "
End If


Dim varItem4 As Variant
Dim strCriteria4 As String

If Me.listChamfer.ItemsSelected.Count > 0 Then
    For Each varItem4 In Me.listChamfer.ItemsSelected
    strCriteria4 = strCriteria4 & ",'" & Me.listChamfer.ItemData(varItem4) & 
"'"
    Next varItem4
    strCriteria4 = Right(strCriteria4, Len(strCriteria4) - 1)
Else
    strCriteria4 = "NewTable.Chamfer Like ' * ' "
End If

Dim varItem5 As Variant
Dim strCriteria5 As String

If Me.listFlange.ItemsSelected.Count > 0 Then
    For Each varItem5 In Me.listFlange.ItemsSelected
    strCriteria5 = strCriteria5 & "," & Me.listFlange.ItemData(varItem5)
    Next varItem5
    strCriteria5 = Right(strCriteria5, Len(strCriteria5) - 1)
Else
    strCriteria5 = "NewTable.Flange_Type Like ' * '"
End If


    
strSQL = "SELECT * FROM NewTable " & _
            "WHERE NewTable.MFG IN(" & strCriteria & ") and NewTable.Process 
IN(" & strCriteria2 & ") and NewTable.Cast IN(" & strCriteria3 & ")  and 
NewTable.Chamfer IN(" & strCriteria4 & ") and NewTable.Flange_Type IN(" & 
strCriteria5 & ") And NewTable.Group>=(" & cboGroupLow & ") And 
NewTable.Group<=(" & cboGroupHigh & ") AND NewTable.Seal>=(" & cboSealLow & 
") And NewTable.Seal<=(" & cboSealHigh & ") AND NewTable.Sa>=(" & cboSaLow & 
") And NewTable.Sa<=(" & cboSaHigh & ") AND NewTable.Sq>=(" & cboSqLow & ") 
And NewTable.Sq<=(" & cboSqHigh & ") AND NewTable.Sp>=(" & cboSpLow & ") And 
NewTable.Sp<=(" & cboSpHigh & ") AND NewTable.Sv>=(" & cboSvLow & ") And 
NewTable.Sv<=(" & cboSvHigh & ") AND NewTable.St>=(" & cboStLow & ") And 
NewTable.St<=(" & cboStHigh & ") AND NewTable.Ssk>=(" & cboSskLow & ") And 
NewTable.Ssk<=(" & cboSskHigh & ") AND NewTable.Sku>=(" & cboSkulow & ") And 
NewTable.Sku<=(" & cboSkuHigh & ") AND NewTable.Sz>=(" & cboSzLow & ") And 
NewTable.Sz<=(" & cboSzHigh & ") " & _
            "AND NewTable.Smvr>=(" & cboSmvrLow & ") And NewTable.Smvr<=(" & 
cboSmvrHigh & ") AND NewTable.Sds>=(" & cboSdsLow & ") And NewTable.Sds<=(" & 
cboSdsHigh & ") AND NewTable.Sal>=(" & cboSalLow & ") And NewTable.Sal<=(" & 
cboSalHigh & ") AND NewTable.Std>=(" & cboStdLow & ") And NewTable.Std<=(" & 
cboStdHigh & ") AND NewTable.Sdq>=(" & cboSdqLow & ") And NewTable.Sdq<=(" & 
cboSdqHigh & ") AND NewTable.Sdr>=(" & cboSdrLow & ") And NewTable.Sdr<=(" & 
cboSdrHigh & ") AND NewTable.Sk>=(" & cboSkLow & ") And NewTable.Sk<=(" & 
cboSkHigh & ") AND NewTable.Spk>=(" & cboSpkLow & ") And NewTable.Spk<=(" & 
cboSpkHigh & ") AND NewTable.Svk>=(" & cboSvkLow & ") And NewTable.Svk<=(" & 
cboSvkHigh & ") AND NewTable.Ra>=(" & cboRaLow & ") And NewTable.Ra<=(" & 
cboRaHigh & ") AND NewTable.Rp>=(" & cboRpLow & ") And NewTable.Rp<=(" & 
cboRpHigh & ") AND NewTable.Rv>=(" & cboRvLow & ") And NewTable.Rv<=(" & 
cboRvHigh & ") AND NewTable.Rt>=(" & cboRtLow & ") And NewTable.Rt<=(" & 
cboRtHigh & ")" & _
            " AND NewTable.Rsk>=(" & cboRskLow & ") And NewTable.Rsk<=(" & 
cboRskHigh & ") AND NewTable.Rku>=(" & cboRkuLow & ") And NewTable.Rku<=(" & 
cboRkuHigh & ") AND NewTable.Rz>=(" & cboRzLow & ") And NewTable.Rz<=(" & 
cboRzHigh & ") AND NewTable.RTp>=(" & cboRTpLow & ") And NewTable.RTp<=(" & 
cboRTpHigh & ") AND NewTable.Rk>=(" & cboRkLow & ") And NewTable.Rk<=(" & 
cboRkHigh & ") AND NewTable.Rpk>=(" & cboRpkLow & ") And NewTable.Rpk<=(" & 
cboRpkHigh & ") AND NewTable.Rvk>=(" & cboRvkLow & ") And NewTable.Rvk<=(" & 
cboRvkHigh & ") AND NewTable.PV>=(" & cboPV2Dlow & ") And NewTable.PV<=(" & 
cboPV2DHigh & ")  AND NewTable.PV_3D>=(" & cboPV3DLow & ")  And 
NewTable.PV_3D<=(" & cboPV3DHigh & ")" & _
            "ORDER BY NewTable.Group, NewTable.Seal;"

qdf.SQL = strSQL

DoCmd.OpenQuery "SortedSeals", acViewNormal, acEdit

Set db = Nothing
Set qdf = Nothing


DoCmd.Close acForm, "frmSelectSeals"

End Sub

Sorry for the mess with the SQLstring but it is correct when shown in visual 
basic
"Dale Fye" wrote:

> Post the code you think is causing the problem, and I'll take a look at it.
> -- 
> Email address is not valid.
> Please reply to newsgroup only.
> 
> 
> "swordsman8" wrote:
> 
> > Hello Dale,
> > 
> > I am needing a little more help.  I see what you are saying but I do not 
> > think I can do correctly from what I have so here we go.
> > 
> > Field Name: Comments
> > Form Name: frmSelectSeals
> > 
> > I think the problem is either I am not setting up the filter properly or it 
> > is because of the way I have the rest of my code writen.  Part of what the 
> > code does is make the SQL string placed in the querry.  This deletes the last 
> > search criteria and makes the new one the SQL string.
> > 
> > Could you please explain to me how to have it work properly.
> > 
> > I am getting better at writing the code but I a still a novice.
> > 
> > Thank you,
> > Swordsman8
> > 
> > On my OK button (used when you have made all of your selection) I have all 
> > of my code writen in the button on click command.  What it does it delete the 
> > 
> > "Dale Fye" wrote:
> > 
> > > Swordsman,
> > > 
> > > How I would handle this would depend on whether you want to be able to 
> > > search for a single word, or for multiple key words at the same time.
> > > 
> > > 1.  If you want to filter for a single key word, I would recommend putting a 
> > > textbox in the forms header or footer, along with command buttons to filter 
> > > and clear the filter.  Using this technique, you would type the keyword in 
> > > the text box, and add some code in the click event of the Filter command 
> > > button, something like:
> > > 
> > > Private sub cmd_Filter_Click
> > > 
> > >      me.filter = "[CommentField] Like '*'" & me.txt_Filter & "'*'"
> > >      me.FilterOn = True
> > > 
> > > end sub
> > > 
> > > Private sub cmd_FilterClear_Click
> > > 
> > >     me.filter = ""
> > >     me.filterOn = false
> > > 
> > > end sub
> > > 
> > > 2.  If you want to filter on multiple words, what I have done in the past is 
> > > something similar to above, but you have to parse the textbox contents first. 
> > >  It might look something like:
> > > 
> > > Private Sub cmd_Filter_Click()
> > > 
> > >    Dim A() As String
> > >    Dim intLoop As Integer
> > >    Dim varFilter As Variant
> > >    
> > >    A = Split(Me.txt_Filter, " ")
> > >    
> > >    varFilter = Null
> > >    For intLoop = LBound(A) To UBound(A)
> > >       varFilter = (varFilter + " AND ") _
> > >                 & "[CommentField] Like '*'" & A(intLoop) & "'*'"
> > >    Next
> > > 
> > >    If Len(varFilter & "") = 0 Then
> > >       Me.Filter = ""
> > >       Me.FilterOn = False
> > >    Else
> > >       Me.Filter = varFilter
> > >       Me.FilterOn = True
> > >    End If
> > >    
> > > End Sub
> > > 
> > > HTH
> > > Dale
> > > -- 
> > > Email address is not valid.
> > > Please reply to newsgroup only.
> > > 
> > > 
> > > "swordsman8" wrote:
> > > 
> > > > OK so here is where I am and what I am trying to do next.
> > > > 
> > > > Where I am.
> > > > I have my Visual Basic code tied into the OK command button.  I have a Form 
> > > > to search through my data and only put the requested information in a query.  
> > > > So far I have all of this working fine.  I have the code clear the query each 
> > > > time it is used and repopulate the querry with the new choices.(The Where 
> > > > From etc...)
> > > > 
> > > > The Problem with what I am trying to do next.  
> > > > It has been decided that there needs to be a comments column.  They then 
> > > > what the option to search for a key word in the column to define the results. 
> > > >  The other problem is that the comments field has no specific order of info 
> > > > in it.  This means while multiple rows have the same info in the comments 
> > > > field each row could have a different was of saying it.
> > > > Example
> > > >   Laser Cut, Production
> > > >   Production, Laser Cut
> > > > 
> > > > So here is it.
> > > > In visual basic I need to be able to do the following:
> > > > Leave Field blank (so not to limit results)
> > > > Input a key word to limit results
> > > > 
> > > > 
> > > > Thank you,
> > > > Swordsman8
> > > > If you have question just let me know.
> > > > 
0
Utf
8/28/2007 1:54:02 PM
Hello Anyone,

I need help and have not gotten a reply from the person that was helping me. 
 In the last post I gave my current code which is attached to my OK button.

He gave me code to put in the header but I think my OK button code was 
making it not work or I did not understand how to input the suggested code.  

If some one could help I could really use it.

Thank you,
Steven Swordsman8

"swordsman8" wrote:

> Hello,
> 
> Here is the code for my OK command.
> 
> It does not contain anything about the comments field.  I thought you could 
> put in what is needed.
> 
> Thank you,
> Swordsman8
> 
> 
> Private Sub cmdOk_Click()
>     
> Dim db As DAO.Database
> Dim qdf As DAO.QueryDef
> Dim varItem As Variant
> Dim strCriteria As String
> Dim strSQL As String
> 
> 
> Set db = CurrentDb()
> Set qdf = db.QueryDefs("SortedSeals")
> 
> If Me.listMfg.ItemsSelected.Count > 0 Then
>     For Each varItem In Me.listMfg.ItemsSelected
>     strCriteria = strCriteria & ",'" & Me.listMfg.ItemData(varItem) & "'"
>     Next varItem
>     strCriteria = Right(strCriteria, Len(strCriteria) - 1)
> Else
>     strCriteria = "NewTable.MFG Like ' * ' "
> End If
> 
> Dim varItem2 As Variant
> Dim strCriteria2 As String
> 
> If Me.listProcess.ItemsSelected.Count > 0 Then
>     For Each varItem2 In Me.listProcess.ItemsSelected
>     strCriteria2 = strCriteria2 & ",'" & Me.listProcess.ItemData(varItem2) & 
> "'"
>     Next varItem2
>     strCriteria2 = Right(strCriteria2, Len(strCriteria2) - 1)
> Else
>     strCriteria2 = "NewTable.Process Like ' * ' "
> End If
> 
> 
> Dim varItem3 As Variant
> Dim strCriteria3 As String
> 
> If Me.listCast.ItemsSelected.Count > 0 Then
>     For Each varItem3 In Me.listCast.ItemsSelected
>     strCriteria3 = strCriteria3 & ",'" & Me.listCast.ItemData(varItem3) & "'"
>     Next varItem3
>     strCriteria3 = Right(strCriteria3, Len(strCriteria3) - 1)
> Else
>     strCriteria3 = "NewTable.Cast Like ' * ' "
> End If
> 
> 
> Dim varItem4 As Variant
> Dim strCriteria4 As String
> 
> If Me.listChamfer.ItemsSelected.Count > 0 Then
>     For Each varItem4 In Me.listChamfer.ItemsSelected
>     strCriteria4 = strCriteria4 & ",'" & Me.listChamfer.ItemData(varItem4) & 
> "'"
>     Next varItem4
>     strCriteria4 = Right(strCriteria4, Len(strCriteria4) - 1)
> Else
>     strCriteria4 = "NewTable.Chamfer Like ' * ' "
> End If
> 
> Dim varItem5 As Variant
> Dim strCriteria5 As String
> 
> If Me.listFlange.ItemsSelected.Count > 0 Then
>     For Each varItem5 In Me.listFlange.ItemsSelected
>     strCriteria5 = strCriteria5 & "," & Me.listFlange.ItemData(varItem5)
>     Next varItem5
>     strCriteria5 = Right(strCriteria5, Len(strCriteria5) - 1)
> Else
>     strCriteria5 = "NewTable.Flange_Type Like ' * '"
> End If
> 
> 
>     
> strSQL = "SELECT * FROM NewTable " & _
>             "WHERE NewTable.MFG IN(" & strCriteria & ") and NewTable.Process 
> IN(" & strCriteria2 & ") and NewTable.Cast IN(" & strCriteria3 & ")  and 
> NewTable.Chamfer IN(" & strCriteria4 & ") and NewTable.Flange_Type IN(" & 
> strCriteria5 & ") And NewTable.Group>=(" & cboGroupLow & ") And 
> NewTable.Group<=(" & cboGroupHigh & ") AND NewTable.Seal>=(" & cboSealLow & 
> ") And NewTable.Seal<=(" & cboSealHigh & ") AND NewTable.Sa>=(" & cboSaLow & 
> ") And NewTable.Sa<=(" & cboSaHigh & ") AND NewTable.Sq>=(" & cboSqLow & ") 
> And NewTable.Sq<=(" & cboSqHigh & ") AND NewTable.Sp>=(" & cboSpLow & ") And 
> NewTable.Sp<=(" & cboSpHigh & ") AND NewTable.Sv>=(" & cboSvLow & ") And 
> NewTable.Sv<=(" & cboSvHigh & ") AND NewTable.St>=(" & cboStLow & ") And 
> NewTable.St<=(" & cboStHigh & ") AND NewTable.Ssk>=(" & cboSskLow & ") And 
> NewTable.Ssk<=(" & cboSskHigh & ") AND NewTable.Sku>=(" & cboSkulow & ") And 
> NewTable.Sku<=(" & cboSkuHigh & ") AND NewTable.Sz>=(" & cboSzLow & ") And 
> NewTable.Sz<=(" & cboSzHigh & ") " & _
>             "AND NewTable.Smvr>=(" & cboSmvrLow & ") And NewTable.Smvr<=(" & 
> cboSmvrHigh & ") AND NewTable.Sds>=(" & cboSdsLow & ") And NewTable.Sds<=(" & 
> cboSdsHigh & ") AND NewTable.Sal>=(" & cboSalLow & ") And NewTable.Sal<=(" & 
> cboSalHigh & ") AND NewTable.Std>=(" & cboStdLow & ") And NewTable.Std<=(" & 
> cboStdHigh & ") AND NewTable.Sdq>=(" & cboSdqLow & ") And NewTable.Sdq<=(" & 
> cboSdqHigh & ") AND NewTable.Sdr>=(" & cboSdrLow & ") And NewTable.Sdr<=(" & 
> cboSdrHigh & ") AND NewTable.Sk>=(" & cboSkLow & ") And NewTable.Sk<=(" & 
> cboSkHigh & ") AND NewTable.Spk>=(" & cboSpkLow & ") And NewTable.Spk<=(" & 
> cboSpkHigh & ") AND NewTable.Svk>=(" & cboSvkLow & ") And NewTable.Svk<=(" & 
> cboSvkHigh & ") AND NewTable.Ra>=(" & cboRaLow & ") And NewTable.Ra<=(" & 
> cboRaHigh & ") AND NewTable.Rp>=(" & cboRpLow & ") And NewTable.Rp<=(" & 
> cboRpHigh & ") AND NewTable.Rv>=(" & cboRvLow & ") And NewTable.Rv<=(" & 
> cboRvHigh & ") AND NewTable.Rt>=(" & cboRtLow & ") And NewTable.Rt<=(" & 
> cboRtHigh & ")" & _
>             " AND NewTable.Rsk>=(" & cboRskLow & ") And NewTable.Rsk<=(" & 
> cboRskHigh & ") AND NewTable.Rku>=(" & cboRkuLow & ") And NewTable.Rku<=(" & 
> cboRkuHigh & ") AND NewTable.Rz>=(" & cboRzLow & ") And NewTable.Rz<=(" & 
> cboRzHigh & ") AND NewTable.RTp>=(" & cboRTpLow & ") And NewTable.RTp<=(" & 
> cboRTpHigh & ") AND NewTable.Rk>=(" & cboRkLow & ") And NewTable.Rk<=(" & 
> cboRkHigh & ") AND NewTable.Rpk>=(" & cboRpkLow & ") And NewTable.Rpk<=(" & 
> cboRpkHigh & ") AND NewTable.Rvk>=(" & cboRvkLow & ") And NewTable.Rvk<=(" & 
> cboRvkHigh & ") AND NewTable.PV>=(" & cboPV2Dlow & ") And NewTable.PV<=(" & 
> cboPV2DHigh & ")  AND NewTable.PV_3D>=(" & cboPV3DLow & ")  And 
> NewTable.PV_3D<=(" & cboPV3DHigh & ")" & _
>             "ORDER BY NewTable.Group, NewTable.Seal;"
> 
> qdf.SQL = strSQL
> 
> DoCmd.OpenQuery "SortedSeals", acViewNormal, acEdit
> 
> Set db = Nothing
> Set qdf = Nothing
> 
> 
> DoCmd.Close acForm, "frmSelectSeals"
> 
> End Sub
> 
> Sorry for the mess with the SQLstring but it is correct when shown in visual 
> basic
> "Dale Fye" wrote:
> 
> > Post the code you think is causing the problem, and I'll take a look at it.
> > -- 
> > Email address is not valid.
> > Please reply to newsgroup only.
> > 
> > 
> > "swordsman8" wrote:
> > 
> > > Hello Dale,
> > > 
> > > I am needing a little more help.  I see what you are saying but I do not 
> > > think I can do correctly from what I have so here we go.
> > > 
> > > Field Name: Comments
> > > Form Name: frmSelectSeals
> > > 
> > > I think the problem is either I am not setting up the filter properly or it 
> > > is because of the way I have the rest of my code writen.  Part of what the 
> > > code does is make the SQL string placed in the querry.  This deletes the last 
> > > search criteria and makes the new one the SQL string.
> > > 
> > > Could you please explain to me how to have it work properly.
> > > 
> > > I am getting better at writing the code but I a still a novice.
> > > 
> > > Thank you,
> > > Swordsman8
> > > 
> > > On my OK button (used when you have made all of your selection) I have all 
> > > of my code writen in the button on click command.  What it does it delete the 
> > > 
> > > "Dale Fye" wrote:
> > > 
> > > > Swordsman,
> > > > 
> > > > How I would handle this would depend on whether you want to be able to 
> > > > search for a single word, or for multiple key words at the same time.
> > > > 
> > > > 1.  If you want to filter for a single key word, I would recommend putting a 
> > > > textbox in the forms header or footer, along with command buttons to filter 
> > > > and clear the filter.  Using this technique, you would type the keyword in 
> > > > the text box, and add some code in the click event of the Filter command 
> > > > button, something like:
> > > > 
> > > > Private sub cmd_Filter_Click
> > > > 
> > > >      me.filter = "[CommentField] Like '*'" & me.txt_Filter & "'*'"
> > > >      me.FilterOn = True
> > > > 
> > > > end sub
> > > > 
> > > > Private sub cmd_FilterClear_Click
> > > > 
> > > >     me.filter = ""
> > > >     me.filterOn = false
> > > > 
> > > > end sub
> > > > 
> > > > 2.  If you want to filter on multiple words, what I have done in the past is 
> > > > something similar to above, but you have to parse the textbox contents first. 
> > > >  It might look something like:
> > > > 
> > > > Private Sub cmd_Filter_Click()
> > > > 
> > > >    Dim A() As String
> > > >    Dim intLoop As Integer
> > > >    Dim varFilter As Variant
> > > >    
> > > >    A = Split(Me.txt_Filter, " ")
> > > >    
> > > >    varFilter = Null
> > > >    For intLoop = LBound(A) To UBound(A)
> > > >       varFilter = (varFilter + " AND ") _
> > > >                 & "[CommentField] Like '*'" & A(intLoop) & "'*'"
> > > >    Next
> > > > 
> > > >    If Len(varFilter & "") = 0 Then
> > > >       Me.Filter = ""
> > > >       Me.FilterOn = False
> > > >    Else
> > > >       Me.Filter = varFilter
> > > >       Me.FilterOn = True
> > > >    End If
> > > >    
> > > > End Sub
> > > > 
> > > > HTH
> > > > Dale
> > > > -- 
> > > > Email address is not valid.
> > > > Please reply to newsgroup only.
> > > > 
> > > > 
> > > > "swordsman8" wrote:
> > > > 
> > > > > OK so here is where I am and what I am trying to do next.
> > > > > 
> > > > > Where I am.
> > > > > I have my Visual Basic code tied into the OK command button.  I have a Form 
> > > > > to search through my data and only put the requested information in a query.  
> > > > > So far I have all of this working fine.  I have the code clear the query each 
> > > > > time it is used and repopulate the querry with the new choices.(The Where 
> > > > > From etc...)
> > > > > 
> > > > > The Problem with what I am trying to do next.  
> > > > > It has been decided that there needs to be a comments column.  They then 
> > > > > what the option to search for a key word in the column to define the results. 
> > > > >  The other problem is that the comments field has no specific order of info 
> > > > > in it.  This means while multiple rows have the same info in the comments 
> > > > > field each row could have a different was of saying it.
> > > > > Example
> > > > >   Laser Cut, Production
> > > > >   Production, Laser Cut
> > > > > 
> > > > > So here is it.
> > > > > In visual basic I need to be able to do the following:
> > > > > Leave Field blank (so not to limit results)
> > > > > Input a key word to limit results
> > > > > 
> > > > > 
> > > > > Thank you,
> > > > > Swordsman8
> > > > > If you have question just let me know.
> > > > > 
0
Utf
9/10/2007 1:44:02 PM
Reply:

Similar Artilces:

How create rule that searches BOTH body and subject (OR not AND)?
When I check the boxes in Advanced Rules for finding a term in the body of a message and then the subject line, the resulting line ANDs it -- that is the term has to appear in both the subject and the body. This is not what I want. I want to screen emails where this term appears in either the subject line or body. That is, in Boolean terms, I want to OR this, not AND it. I think you'd have to create two rules to do that... "kdez" <kdez@discussions.microsoft.com> wrote in message news:CAB18A6D-2106-4783-9C7A-88517E0709BA@microsoft.com... > When I check the boxes in...

field no show
The following query does not show the ID field. This is imperative because data change is dependent upon this field showing. select member_time.id, member_time.date, member_time.timein, member_time.timeout from member_time where member_time.date = #4/16/2010# This is written in a access database. Thanks That's strange. Maybe it's hidden? Try this: SELECT member_time.id, member_time.date, member_time.timein, member_time.timeout, member_time.id as TheID FROM member_time WHERE member_time.date = #4/16/2010# ; If that doesn't work, try this: SELEC...

MultiList Select Box Search Form
I posted this question awhile ago, and never got a chance to get back to check for any responses till now. I see Doug's (Thank you) and did what he suggested, but got a kink while doing that. I also am not sure of if I should post again, like I am now, or just reply to the old post. So anyway..... I came up with a problem when typing in & _ (That is simply an ampersand and a underscore, correct?) """, " After I enter that code, those two lines turn red and I get a vb error window saying: Compile error: Expected: line number or label or statement ...

Windows mail error message 12-18-09
What that means?: The message could not be sent. The authentication setting might not be correct for your outgoing e-mail [SMTP] server. For help solving this problem, go to Help, search for "Troubleshoot Windows Mail", and read the "I'm having problems sending e-mail" section. If you need help determining the proper server settings, please contact your e-mail service provider. The rejected e-mail address was 'phoenixgym@aol.com'. Subject 'World Champion Kayla Williams is competing in the Excalibur Cup 2010 (Virginia Beach)', Account: ...

Windows Media Player cannot play file because a network error occu
I am using Media Player 11 in Windows Vista and I cannot seem to play videos imbedded on websites. If someone sends me a WMV file in email, I can play it just fine. Just not ones on websites. I do not get an error code. Only a pop-up box that says what I have in the subject line - plus "The server might not be available. Verify that you are connected to the network and that your proxy settings are correct." A friend of mine also has MP 11 and Vista and it works just fine. On Fri, 13 Nov 2009 09:29:02 -0800, his1987 <his1987@discussions.microsoft.com&g...

Entourage Error 107
Recently, I have not been able to sent or receive corporate email from Entourage. Error: Am unknown error has occurred in Entourage Explanation: Mail could not be sent Account name: Sprint Exchange Account Error 107 Mac's are not supported by IT here. I have verified my settings in Entourage with other unsupported Corp Mac users and everything seems to be set correctly. I am running Mac Office/Entourage 2008 and have applied all available updates. Any help would be greatly appreciated. Thanks, -Greg Greg wrote: > Recently, I have not been able to sent or rec...

View equations created in Word 2007
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: intel Greetings! I've successfully installed Office 2008 update 12.0.1 on my MacBook Pro running 10.5.2. One of the fixes that was listed in the Microsoft Knowledgebase article associated with the update was the ability to edit equations created in Word 2007 for Windows. After applying the update, I still get a warning message when opening a file created in Word 2007: "This file contains Word 2007 for Windows equations"; the document opens with placeholders (blank squares) instead of the equations. Does anyone el...

Format all comments made now and in future to be size 14
How do you format all comments made, in all workbooks, to be 14 Times New Roman? How do you do it before, not after... Check out the below by Debra Dalgleish http://www.contextures.com/xlcomments02.html#Default If this post helps click Yes --------------- Jacob Skaria "annc5411" wrote: > How do you format all comments made, in all workbooks, to be 14 Times New > Roman? How do you do it before, not after... ...

Mail Merge and conditional formatting Word 2007
Need some Help.. My disconnects mainly pertain to the use of e-mail merge in Word 2007. The data file I need to use currently resides in an Excel spreadsheet because of the need for several formulas. I can merge most of the data successfully with the exception of: =B7 Multiple rows of data per e-mail. =B7 Cannot edit individual e-mails prior to completing/sending the merge. (This is possible with a regular letter merge, but cannot do this with e-mail merge) =B7 Merging conditional formatting icons (if this is even possible, I don't know) We're using OnMa...

Re: 'Uknown Error 0x800CCC97'
I just heard back from the folks with whom I filed this bug. They say the bug is fixed in cppop 5.4 - request that your ISP upgrade to that. -- Jeff Stephenson Outlook Development This posting is provided "AS IS" with no warranties, and confers no rights "Jeff Stephenson [MSFT]" <stephenson@online.microsoft.com> wrote in message news:... > See the attached reply to another similar question. Your ISP's POP3 server > has a bug, and they should get a fixed version of the server. > > -- > Jeff Stephenson > Outlook Development > This posting...

Search Form 11-19-09
I have created a search form that has unbound text boxes to search the database. There are fields for SSN's, FEIN's and a permit number. When I search on any of these numbers I get multiple records even though these records are all unique? Any pointers will help, I wish I could load the database here. thanks On Nov 20, 8:54=A0am, Dave <davidstev...@gmail.com> wrote: > I have created a search form that has unbound text boxes to search the > database. There are fields for SSN's, FEIN's and =A0a permit number. > When I search on any of these numbers I...

strange behavior excel templates (in comparison word templates)
Hello, I have a question, In word there is the possibility to attach a template to a *.doc file. That template is specific for that doc (attached template). If you open the doc the macros in the dot will be executed. In excel there's no such thing as attached template beneath a xls (workbook). I made an Addin application and placed a template in the templates directory or another start file in the start directory but in all that cases you start the macros in all the xls files you open. I want to open the macros only when a specific xls (example test.xls) is opened and not by another one (o...

Econnect error when same item on PO more than once when receiving.
DOC 30 ERROR: Microsoft.Dynamics.GP.eConnect: Number = 9344 Stored Procedure taPopRcptLineInsert : Description = PO Line number is required - item exists on more than one line. Does Econnect not support this scenario while the GP screens do? Thanks. Rich: I had the same type of error but awhile back but I was passing my document wrong when I was trying to update it. I had the same item number on seperate lines and of course I never passed the parameter @I_vPOLNENUM. Well of course eConnect didn't know which line to update thus I kept getting that 9344 error. After some t...

Error Message When Opening Excel #3
Everytime i open Excel or an Excel document, i get the following error message: "SUMIF.XLA is already open. Reopening will cause any change you made to be discarded. Do you want to reopen SUMIF.XLA?" Whether i answer YES or NO, the application will open normally. It is just very annouying.. HELP -- W Walid You could try looking under Tools>Add ins... and then uncheck anything, then check back those that were checked one at a time, close and re-open excel, when the error comes back, that's the faulty add-in, either go to the vendor or unload the add-in if you don&#...

Is the bug "Word does not remember position of window" still not fixed?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel It looks like I've got this problem and in searching this board I notice that its described as a known bug in 2008. <br><br>Can it be that after two years and so many upgrades that Microsoft still has not fixed this? <br><br>OK, its not a huge deal, but I would be most grateful if someone would recommend a work around. The condition "still exists". But it's not a *Microsoft* bug :-) To be a bug according to Microsoft, they would have needed to DESIGN Word to remem...

Access to Microsoft forums and error 13
I wanted to get a wider audience for the error 13 problem that may have been fixed with the latest download. I signed up for the Microsoft's green button, received a confirmation but can't log on. I probably have to wait for someone to come in on Monday. Meanwhile, could someone use the green button media center forum to confirm that the problem was introduced with the previous to last fix and the latest fix solved the problem. I can't verify the fix because I switched to cable and the problem is unique to dialup (switched lines). There's no information with ...

How to copy "Ignore Error" all through?
Hello I have a formula wherein the result is ok, but gets flagged "missing adjacent cells". I select the "Ignore this error" but how to copy this across all cells? Or do I have to do it on every cell? Thanks Select that whole range--make the active cell one of the cells with that error. Then click on the flag and choose "Ignore Error". dindigul wrote: > > Hello > I have a formula wherein the result is ok, but gets flagged "missing > adjacent cells". I select the "Ignore this error" but how to copy this > across all cells?...

Problems trying to update Pub 2003 with service pack etc.
Apologies for posting this msg. here but I can't use the normal channels. Just installed Pub. 2003. Tried updating to the latest service pack but the installation won't finish, keeps generating an error (IE has encountered a problem etc.). Tried sending support a msg. but same problem, IE keeps clsoing on me. (Also, it seems a plug-in is causing problems - Microsoft sniffer tool). Using XP Pro. PSPP ID: = 6910. Help please! How to troubleshoot failures updating your Office installation from the Office Update Web site http://support.microsoft.com/default.aspx?scid=kb;en-us;30449...

Error in database....
A user posted a batch in payables management. After posting, there was an error encountered. It displays that the table updating was interrupted, use batch recovery to continue the posting. But when I used the batch recovery, it was not successful to continue the update process. When I click the "More Details" button it displays, A save operation on table 'PM_Transaction_WORK' caused a sharing error. How can I resolve this issue? Thanks, John John, it is a db sharing violation. Have all users logout DELETE tempdb..DEX_LOCK DELETE tempd..DEX_SESSION DELETE dynami...

Error Connecting
Using Outlook 2003 w/ Windows XP Pro, error occurs when attempting to download an email (spam) that has no subject line or sender address. I can download Inbox headers and delete the offending email, then continue email download. Have seen other threads w/ similar problem, but no solution found yet. Obviously I can work around it, but I get this type of spam 2 to 3 times a week (sometimes 2 or 3 a day). If I download 20 emails before it hits this snag, I either get to download them again, or go through the headers and delete the ones I've already received. Incapacitating? - No. Anno...

Event Error Question
Can anyone tell me what the foioloing event eree is and if there is a way to prevent it? Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99" could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041003. Events cannot be delivered through this filter until the problem is corrected. I google the event adn got several different opinions, one being caused by root worms?? James ...

ntuser.dat error message
When I bring up Outlook Express, I'm receiving the following error message: Cannot delete ntuser.dat: It is being used by another person or program. Close any programs that might be using the file and try again. This just started happening in the past few days. Outlook is the 1st thing (and only program that I know of) that is running. How can I make this stop. I'm lost. Regards Gerry Hi Gerry, I understand you are receiving the following error message when you open Outlook Express. "Cannot delete ntuser.dat: It is being used by another person or program, close any programs...

Column searching problem
I have a worksheet called "net" containing the following: NETWORK AVG MIN MAX STD SAMPLES ABC 17.17 16.26 17.71 0.4469 19 CBS 12.99 11.69 14.56 0.6524 30 NBC 15.39 14.08 16.70 0.7323 38 NBC* 15.12 14.08 15.99 0.4910 31 Fox 10.63 9.07 12.09 0.9374 8 HBO 10.94 9.07 13.22 1.2507 19 Showtime 11.52 6.84 13.23 1.9017 11 HDNet 18.14 14.22 18.85 1.1619 14 HDNet* 18.45 18.13 18.85 0.2847 13 HDNet-Movies 1...

Outlook errors #2
When I start Outlook it immediately comes up with an error: msouplug.dll Does anyone have any advice on how to repair this fault or is there a way to get access to the contacts within Outlook if I cannot get it to open? Thank you Do you have any Symantec programs installed for Outlook? I believe that's where this file comes from. If you start Outlook in safe mode, you should be able to get in and remove that add-in. Close Outlook Select Start | Run Enter Outlook.exe /Safe Select OK Select Tools | Options | Other | Advanced Options | Add-In Manager Uncheck any Symantec add-in...

XML error "Some Data Was Imported As Text"
Daily, I recieve a 3rd party XML file that I parse in Excel (using an excel macro) and then import into an Access database. Infrequently, the data will import into Excel, then parse and then the routine stops with the error message above. I look through the raw XML file and everything appears to be within the brackets, etc. Can someone give me some clarification to the meaning of the error message? Thanks in advance and Mery Christmas and Happy Holidays! The error message might be generated within your macro - as it is parsing the data it might detect that some field which should be ...