Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

VBA for search

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Situmorang - 11 Mar 2008 03:41 GMT
Hello,

I will have a minutes of meeting table as follows:
1. Autonumber
2. Decision number
3. Date
4.Decisions which is a MEMO field.

What is the VBA if we want to use a search by key word. Is there any sample
for this?

Thanks

Frank
Signature

H. Frank Situmorang

Beetle - 11 Mar 2008 04:53 GMT
Here's what we know so far.

1) you have a table.

2) you want to search for something.

More info perhaps?

Are you working in a form?
Are you trying to search the memo field for certain words?

Signature

_________

Sean Bailey

> Hello,
>
[quoted text clipped - 10 lines]
>
> Frank
Frank Situmorang - 11 Mar 2008 13:09 GMT
Beetle, I am working in a form to see the memo field.
Signature

H. Frank Situmorang

> Here's what we know so far.
>
[quoted text clipped - 21 lines]
> >
> > Frank
Beetle - 11 Mar 2008 17:07 GMT
You could add an unbound text box for searching, then use the
After Update event of the text box to run the code. Something like;

Dim strSQL As String

strSQL = "Select tblMeetings.DecisionNumber, tblMeetings.Date, " &_
             "tblMeetings.Decisions From tblMeetings Where " &_
             "tblMeetings.Decisions LIKE """ & "*" & Me.txtSearch & "*" & """

currentdb.Execute strSQL, dbFailOnError

Or if your form is based on a query then you could apply a filter like;

Dim strFilter As String

strFilter =   "([Decisions] LIKE """ & "*" & Me.txtSearch & "*" & """)"

Me.Filter = strFilter
Me.FilterOn = True

You'll need to modify table, field & control names, adjust for line wrap,
quote placement etc., but this may give you a couple of things to try.

BTW - Access has certain words that are "reserved" (like Date) that should
not be used for field and control names. For a list of these words and why
you should not use them see;

http://allenbrowne.com/AppIssueBadWord.html
Signature

_________

Sean Bailey

Frank Situmorang - 12 Mar 2008 04:01 GMT
Thanks Beetle, I'll give a try
Signature

H. Frank Situmorang

> You could add an unbound text box for searching, then use the
> After Update event of the text box to run the code. Something like;
[quoted text clipped - 24 lines]
>
> http://allenbrowne.com/AppIssueBadWord.html
Frank Situmorang - 13 Mar 2008 10:17 GMT
Beetle,

I have tried it, this is my VBA:
Private Sub Textcari_AfterUpdate()
Dim strSQL As String

'but red color font/hang over here:

strSQL = "Select MOM. TGLRPT_ID, MOM. No_KEP, , MOM. Subject " &_ MOM. Notes
From MOM Where " &_
             " MOM. Notes LIKE """ & "*" & Me.Textcari & "*" & """
'Font is normal again here:
CurrentDb.Execute strSQL, dbFailOnError
End Sub

Pls. help me what goes wrong on my VBA:

For Your info:

I have the form and subform.

Main form is the Meteeng date table

And sub form linked is Decision number/TGLRPT_ID..and I just search by
unbound Textcari

I appreciate your help
Signature

H. Frank Situmorang

> You could add an unbound text box for searching, then use the
> After Update event of the text box to run the code. Something like;
[quoted text clipped - 24 lines]
>
> http://allenbrowne.com/AppIssueBadWord.html
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.