Text Search in for the field of memo does not workd

F

Frank Situmorang

hello,

Here is my VBA, but does not work for text search in my textbox search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
D

Douglas J. Steele

You've declared strSQL, and you attempt to use its content with the Execute
method, but you haven't assigned anything to it.
 
F

Frank Situmorang

Doug, this is told by some one in this forum, but It can not work. soryy for
I am very naive in this database, since my specialty is in accounting and I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
You've declared strSQL, and you attempt to use its content with the Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
hello,

Here is my VBA, but does not work for text search in my textbox search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
D

Douglas J. Steele

See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Frank Situmorang said:
Doug, this is told by some one in this forum, but It can not work. soryy
for
I am very naive in this database, since my specialty is in accounting and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
hello,

Here is my VBA, but does not work for text search in my textbox search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
F

Frank Situmorang

Thanks Dough for your advice.

It seems it has not worked yet maybe I need to inform you more about my Form
and subform

This is similar with contact database sample provided by MS Access.

Actually this is database for Minutes of meeting
I have a table as a parent to the descion table.

In the header I put date of meeting

and in the subforem is decision number, subject and subfrom again to Nota (
memo field for decicions.

The txtCari is the Search box I put it in the form footer ( am I right??)

Thi is is my SQL of the form which is based on Query:
SELECT tblTGLRapat.TGLRPT_ID, tblTGLRapat.TGL_RPT, MOM.KepID,
MOM.TAGLRPT_ID, MOM.No_KEP, MOM.Subject, MOM.Nota
FROM tblTGLRapat INNER JOIN MOM ON tblTGLRapat.TGLRPT_ID = MOM.TAGLRPT_ID;

Thi is the record source of the subform:
SELECT MOM.* FROM MOM ORDER BY MOM.KepID;

Did I miss something?

Also when I tried to save it, there is an error message in box saying:
There is something in valid in this property, try to ck seach help index.....

I appreciate your help m


--
H. Frank Situmorang


Douglas J. Steele said:
See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Frank Situmorang said:
Doug, this is told by some one in this forum, but It can not work. soryy
for
I am very naive in this database, since my specialty is in accounting and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,

Here is my VBA, but does not work for text search in my textbox search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
F

Frank Situmorang

Dough,

I tried to make it like the one suggested by Beetle like this , but still
unsuccesful:
Private Sub Txtcari_AfterUpdate()
'Dim strFilter As String
Dim strSQL As String

strSQL = "Select MOM.No_KEP, MOM.Subject, " & "MOM.Nota From MOM Where "
& "MOM.Nota LIKE """ & "*" & Me.Txtcari & "*" & """"

'strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
CurrentDb.Execute strSQL, dbFailOnError


'Me.Filter = strFilter
'Me.FilterOn = True

End Sub

It hangs here: CurrentDb.Execute strSQL, dbFailOnError

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Frank Situmorang said:
Doug, this is told by some one in this forum, but It can not work. soryy
for
I am very naive in this database, since my specialty is in accounting and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,

Here is my VBA, but does not work for text search in my textbox search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
D

Douglas J. Steele

You cannot use the Execute method with SELECT queries. It can only be used
with Action queries (INSERT INTO, DELETE, UPDATE)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
Dough,

I tried to make it like the one suggested by Beetle like this , but still
unsuccesful:
Private Sub Txtcari_AfterUpdate()
'Dim strFilter As String
Dim strSQL As String

strSQL = "Select MOM.No_KEP, MOM.Subject, " & "MOM.Nota From MOM Where
"
& "MOM.Nota LIKE """ & "*" & Me.Txtcari & "*" & """"

'strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
CurrentDb.Execute strSQL, dbFailOnError


'Me.Filter = strFilter
'Me.FilterOn = True

End Sub

It hangs here: CurrentDb.Execute strSQL, dbFailOnError

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Frank Situmorang said:
Doug, this is told by some one in this forum, but It can not work.
soryy
for
I am very naive in this database, since my specialty is in accounting
and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


:

You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,

Here is my VBA, but does not work for text search in my textbox
search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
F

Frank Situmorang

thanks Doug, your suggestion is OK for me.
Now I want to make it hightlighted, so that we can see the word search.
looks like the when we google it.

Can you help me how to make it?

--
H. Frank Situmorang


Douglas J. Steele said:
You cannot use the Execute method with SELECT queries. It can only be used
with Action queries (INSERT INTO, DELETE, UPDATE)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
Dough,

I tried to make it like the one suggested by Beetle like this , but still
unsuccesful:
Private Sub Txtcari_AfterUpdate()
'Dim strFilter As String
Dim strSQL As String

strSQL = "Select MOM.No_KEP, MOM.Subject, " & "MOM.Nota From MOM Where
"
& "MOM.Nota LIKE """ & "*" & Me.Txtcari & "*" & """"

'strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
CurrentDb.Execute strSQL, dbFailOnError


'Me.Filter = strFilter
'Me.FilterOn = True

End Sub

It hangs here: CurrentDb.Execute strSQL, dbFailOnError

I appreciate your help
--
H. Frank Situmorang


Douglas J. Steele said:
See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug, this is told by some one in this forum, but It can not work.
soryy
for
I am very naive in this database, since my specialty is in accounting
and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


:

You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,

Here is my VBA, but does not work for text search in my textbox
search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 
D

Douglas J. Steele

No easy way to do that in Access.

The only possibility would be to use an RTF control, and put RTF formatting
characters around the words you want highlighted. To me, that's far more
work than it's worth.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
thanks Doug, your suggestion is OK for me.
Now I want to make it hightlighted, so that we can see the word search.
looks like the when we google it.

Can you help me how to make it?

--
H. Frank Situmorang


Douglas J. Steele said:
You cannot use the Execute method with SELECT queries. It can only be
used
with Action queries (INSERT INTO, DELETE, UPDATE)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Frank Situmorang said:
Dough,

I tried to make it like the one suggested by Beetle like this , but
still
unsuccesful:
Private Sub Txtcari_AfterUpdate()
'Dim strFilter As String
Dim strSQL As String

strSQL = "Select MOM.No_KEP, MOM.Subject, " & "MOM.Nota From MOM
Where
"
& "MOM.Nota LIKE """ & "*" & Me.Txtcari & "*" & """"

'strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
CurrentDb.Execute strSQL, dbFailOnError


'Me.Filter = strFilter
'Me.FilterOn = True

End Sub

It hangs here: CurrentDb.Execute strSQL, dbFailOnError

I appreciate your help
--
H. Frank Situmorang


:

See whether reducing it to the following is what you're looking for:

Private Sub Txtcari_AfterUpdate()
Dim strFilter As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True

End Sub

You may also want to add the following code to your form's Load event:

Private Sub Form_Load()

Me.Filter = vbNullString
Me.FilterOn = False

End Sub


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug, this is told by some one in this forum, but It can not work.
soryy
for
I am very naive in this database, since my specialty is in
accounting
and
I
am just selfthought.

I appreciate your help
--
H. Frank Situmorang


:

You've declared strSQL, and you attempt to use its content with the
Execute
method, but you haven't assigned anything to it.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


hello,

Here is my VBA, but does not work for text search in my textbox
search.

Private Sub Txtcari_AfterUpdate()
Dim strSQL As String

strFilter = "([Nota] LIKE """ & "*" & Me.Txtcari & "*" & """)"
Me.Filter = strFilter
Me.FilterOn = True
CurrentDb.Execute strSQL, dbFailOnError

End Sub

Thanks in advance for your help.
 

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