Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 June 18th, 2005, 02:28 PM
Friend of Wrox
 
Join Date: Mar 2005
Location: , , .
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to add search functionality to unbounded form?


Hi guys. I got an unbounded form that allows me update/delete/add records. I want
to add some search functionality to it but I do not know how to do it. I want to be able to search for customername inside customer tables that has customername and customerid columns. I be happy if some one teach me how to add such functionality to my unbounded form. Thanks

http://i5.photobucket.com/albums/y18...7/editform.jpg

       ==> pic of unbounded form
  #2 (permalink)  
Old June 22nd, 2005, 07:34 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Couldn't you just use the combo box wizard and have it look for this information in the tables you want? You can show or hide CustomerID, and use that as your bound column for later functions.

HTH


mmcdonal
  #3 (permalink)  
Old June 22nd, 2005, 09:45 AM
Friend of Wrox
 
Join Date: Mar 2005
Location: , , .
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
 Couldn't you just use the combo box wizard and have it look for this information in the tables you want? You can show or hide CustomerID, and use that as your bound column for later functions.

HTH


mmcdonal
Thank u for u reply. Well i want to be able to search for text. For example i type a few letter of customer name and it goes and finds all those customer names that their name start with those few letters.I be happy if u show me how to do this.Thanks
  #4 (permalink)  
Old June 24th, 2005, 06:34 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sorry for the late reply. Here is how I do a search for customers names with the first few letters (it doesn't matter if the user types 1, 2, 3, 4, etc letters):

Create the query that will go behind the form or report that will display the data when your users look up a last name. I use a continuous form that displays a list of customers with first and last name, and other data, that has a button that allows the user to open a customer data form from the continuous form.)

Anyway, the button that calls the form or report just calls it without any parameters. It could also just call the query itself, but that is not a good way to display data since you can't control data entry at that point.

The query behind the form or report should have this criteria in the LastName column:

'----------

Like [Type the first few letters of the last name of the customer whose record you want to edit:] & "*"

'----------

This will prompt the user to enter "the first few letters" of the users last name. As I said, it doesn't matter how many letters. Of course you also reword the prompt [] how you want it to appear. =)

When the user clicks okay, they will be given the list.

HTH


mmcdonal
  #5 (permalink)  
Old June 24th, 2005, 06:40 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

To continue with your issue, the user would click the button to find the record based on the customers last name. If you present them with a continuous form with the customer data, the user will be able to scroll up and down and find the customer they want. Add all the useful info you need to the continuous form.

On my form, to the right, I have added a button that opens the customer form based on the record selected. In that case I pass the customer ID (hidden on the form) to the customer form like this:

'----------

stLink = "[CustomerID] = " & Me.CustomerID

'----------

Since the customer ID is a number, I can pass it with this syntax. If you wanted to pass text, you would use the following syntax:

'----------

stLink = "[LastName] = " & "'" & Me.LastName & "'"

'----------

This is a bad example since you would get lots of records for all your customers with the same last name, and your users would have to scroll through them again.

You may also need to Close and Open the unbound form as you do all this since it will refresh the recordsource with the new parameters.

HTH


mmcdonal


Similar Threads
Thread Thread Starter Forum Replies Last Post
add functionality SKhna Javascript 0 February 5th, 2008 08:34 AM
How to add attribute to unbounded element 2BOrNot2B XML 4 January 16th, 2007 03:42 PM
How to have a Search Functionality in a Page anand_asv Classic ASP Basics 1 February 2nd, 2006 06:33 PM
passing a value to a field in a unbounded form chacquard Access VBA 3 September 7th, 2005 07:25 AM
Error trying to search for value in unbounded form method Access 0 June 19th, 2005 05:33 PM





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