Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and display results Access 2003 help please... 1

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
I have an Access 2003 database with a table which contains over 1,000 records. In this table I have multiple fields, one of which is a field for the user to add their own unique comments. What I would like to do is to create a form with a text box allowing the user to enter a specific word, then for Access to search the comments field for this word and display the results in a report.

I don't know if this is possible or if Access has any built in features to do this. Any direction would be greatly appreciated. Thank you for reading this post.
 
if you put an action button on the form that you click once you have typed your word you could simply then take the value from the text box and then build it into a sql string that sould be used as your record source for a report....

if you add wild cards to the value in the text box then you could be able to use
select * from table where comments like '*textboxvalue*'

this will return all the records that have Textboxvalue in the comment field.

hope this helps
 
I have put the following query code in the RECORD SOURCE of my REPORT:

SELECT * FROM tbl_data WHERE [tbl_data].[Data_Description] Like [forms]![frm_search]![SearchString];

But it is not transferring the data from the form text box SEARCHSTRING to the REPORT RECORD SOURCE

Can someone see anything wrong with this ? I am missing something. Thank you
 
This part:
Like [forms]![frm_search]![SearchString];

Needs wildcards if you want to search for LIKE items and for text you need quotes

Like Chr(34) & "*" & [forms]![frm_search]![SearchString] & "*" & Chr(34);



Bob Larson
Free Access Tutorials and Samples:
 

On the form frm_search, textbox SearchString, afterupdate property I put the following VBA code:
SearchString = "'*" & SearchString & "*'"

DoCmd.outputto acoutputreport, "rpt_data", "snapshot format", "C:\temp\Report.snp",True

I have put the following query code in the RECORD SOURCE of my rpt_data REPORT:

SELECT * FROM tbl_data WHERE [tbl_data].[Data_Description] Like [forms]![frm_search]![SearchString];

But it is not transferring the data from the form text box SEARCHSTRING to the REPORT RECORD SOURCE

Can someone see anything wrong with this ? I am missing something. Thank you
 
So, in other words -

Remove the After Update code and then use THIS in the query:

Like Chr(34) & "*" & [forms]![frm_search]![SearchString] & "*" & Chr(34);

Bob Larson
Free Access Tutorials and Samples:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top