Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 13th, 2006, 08:22 AM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Search / List Box Question.

I have an Access form that runs a search on a query and returns the results to a listbox on the same form. I have two question regarding the search functionality.

1. Is it possible to search for the exact value for instance I have a Movie rating column and if I put in G and search I get the results for G, PG and PG-13 when all I wanted were G movies..

2. Is it also possible to search starting with the first letter. For example if I put an S in the Movie title line it will only return Movies starting with the letter S and not every single Movie with an S in it.

Thanks in advance for any help it is greatly appriciated.

  #2 (permalink)  
Old July 13th, 2006, 09:37 AM
Friend of Wrox
 
Join Date: Dec 2005
Location: , , .
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1.
Create a text box and command button, Command button on-click event should be set to save the value in the text box to a variable, say srchstr, and then generate a query with the following syntax:

"SELECT * " & _
"FROM Movies " & _
"WHERE Rating = '" & srchstr & "';"

2. Same thing but with the query as
"SELECT * " & _
"FROM Movies " & _
"WHERE Title LIKE '" & srchstr & "*';"

  #3 (permalink)  
Old July 13th, 2006, 01:28 PM
Authorized User
 
Join Date: Jul 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your a Hero thanks a million! This is exactly what I was looking for. Sorry for the noob questions but I am learning :)



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM
Question about List Box MouseDown event Utpal VB.NET 0 August 4th, 2003 03:11 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.