need access 2000 code for searching any part of the field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"


Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Else
DoCmd.OpenForm "frmTestSearc1"

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
 
Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"


Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Else
DoCmd.OpenForm "frmTestSearc1"

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
When the form comes up it is blank. No data comes through.

Ofer said:
Try using like instead of =

criteria = "[Description] Like '*" & item & "*'"

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Shari said:
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"


Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Else
DoCmd.OpenForm "frmTestSearc1"

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
 
When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

RuralGuy said:
Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"


Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Else
DoCmd.OpenForm "frmTestSearc1"

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

RuralGuy said:
Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

criteria = "[Description] Like *'" & item & "'*"


Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Not sure what this means.

RuralGuy said:
Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

RuralGuy said:
Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

criteria = "[Description] Like *'" & item & "'*"


Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

RuralGuy said:
Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:


Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If
I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
I found it, Thanks! It still is not brining back any data and the msg that I
added does not give any value, just <> even when I type in the exact text and
the records gets returned. My query that runs the form is looking at the
following:

[Forms]![frmTestSearch2]![test1]

Do I need to do anything on the form when it opens to re-look at the
criteria?


RuralGuy said:
Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

RuralGuy said:
Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:


Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If
I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Hi Shari,

I would expect the MsgBox to pop up with:

"We have <[Description] Like *''*>"

or

"We have <[Description] Like *'YourValue'*>"

not just "<>"

What is happening?

I found it, Thanks! It still is not brining back any data and the msg that I
added does not give any value, just <> even when I type in the exact text and
the records gets returned. My query that runs the form is looking at the
following:

[Forms]![frmTestSearch2]![test1]

Do I need to do anything on the form when it opens to re-look at the
criteria?


RuralGuy said:
Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

:

Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:

MsgBox "We have said:
Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If
'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
I had typed something incorrectly. I am getting the following message when I
enter data:

We Have <[Description] Like '*1035*'>

then the form opens but it is blank. I am trying to find any text that has
the value of 1035 in it. Once I click ok on the message box, the form opens
and it is empty record. There should actually be two records that appear.
If I enter the Like *1035* in the query, the date appears. Any clues?


RuralGuy said:
Hi Shari,

I would expect the MsgBox to pop up with:

"We have <[Description] Like *''*>"

or

"We have <[Description] Like *'YourValue'*>"

not just "<>"

What is happening?

I found it, Thanks! It still is not brining back any data and the msg that I
added does not give any value, just <> even when I type in the exact text and
the records gets returned. My query that runs the form is looking at the
following:

[Forms]![frmTestSearch2]![test1]

Do I need to do anything on the form when it opens to re-look at the
criteria?


RuralGuy said:
Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

:

Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:

MsgBox "We have <" & criteria & ">"



Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.


I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
I have absolutely no idea what I did, but it is working. Thank you very much
for all your help.

RuralGuy said:
Hi Shari,

I would expect the MsgBox to pop up with:

"We have <[Description] Like *''*>"

or

"We have <[Description] Like *'YourValue'*>"

not just "<>"

What is happening?

I found it, Thanks! It still is not brining back any data and the msg that I
added does not give any value, just <> even when I type in the exact text and
the records gets returned. My query that runs the form is looking at the
following:

[Forms]![frmTestSearch2]![test1]

Do I need to do anything on the form when it opens to re-look at the
criteria?


RuralGuy said:
Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

:

Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:

MsgBox "We have <" & criteria & ">"



Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.


I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Glad to help Shari. I've done the same thing many times in my life and still
don't know what I did. :)

I have absolutely no idea what I did, but it is working. Thank you very much
for all your help.

RuralGuy said:
Hi Shari,

I would expect the MsgBox to pop up with:

"We have <[Description] Like *''*>"

or

"We have <[Description] Like *'YourValue'*>"

not just "<>"

What is happening?

I found it, Thanks! It still is not brining back any data and the msg that I
added does not give any value, just <> even when I type in the exact text and
the records gets returned. My query that runs the form is looking at the
following:

[Forms]![frmTestSearch2]![test1]

Do I need to do anything on the form when it opens to re-look at the
criteria?


:

Hi Shari,

Just scroll down in this post and look for my comments.

Not sure what this means.

:

Answered in line:

When the form opens it is blank. No data comes through. Is there another
piece to the criteria thats needed?

:

Try criteria = "[Description] Like *'" & item & "'*"
I am looking for a way to enter data into a field on a form, then after
update it will search for that data in the queries field and pull up the
records that match in a form view. I want to search any part of the field.
My code is currently as follows:
Dim myDB As Database
Dim criteria As String
Dim item As String
Dim response As Integer
Dim workset As Recordset

item = Me![Test1]
criteria = "[Description] = '" & item & "'"

Change the criteria line to:

criteria = "[Description] Like *'" & item & "'*"

And add this line so we can see what the criteria looks like:

MsgBox "We have <" & criteria & ">"



Set myDB = CurrentDb()
Set workset = myDB.OpenRecordset("tblDailySupport", DB_OPEN_SNAPSHOT)

workset.FindFirst (criteria)

If workset.NoMatch Then
response = MsgBox("No Cases match.")

Change the OpenForm line to:

Else
DoCmd.OpenForm "frmTestSearc1", , , criteria

End If

'DoCmd.FindRecord criteria

The workset.findfirst only pulls up the exact info in the field.
HELP
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.


I hope that makes sense to you. If not then post back.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
Back
Top