need access 2000 code for searching any part of the field

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
 
R

RuralGuy

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.
 
G

Guest

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
 
G

Guest

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.
 
R

RuralGuy

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.
 
G

Guest

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.
 
R

RuralGuy

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.
 
G

Guest

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.
 
R

RuralGuy

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.
 
G

Guest

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.
 
G

Guest

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.
 
R

RuralGuy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top