473,605 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create Search form for database.

50 New Member
Hello I would like to create a search form for my database that searches by:

First
Last
Contact Number
Street
City
State
Zip

What is the easiest way possible to accomplish this? I guess I should mention I have a table called tblcustomerinfo rmation. I would like the search to list possible matches and from that list I would like to be able to click and open the record.

Thank you
Aug 22 '07 #1
25 150729
Stang02GT
1,208 Recognized Expert Top Contributor
Hello I would like to create a search form for my database that searches by:

First
Last
Contact Number
Street
City
State
Zip

What is the easiest way possible to accomplish this? I guess I should mention I have a table called tblcustomerinfo rmation. Once the search is completed I will like it to open the matching record.

There are a couple different ways you can do this...

1.You can have text boxes where the users enter search criteria and then press a "search" button
2.You can have a combo box preform your search. The user can either type in what they want to search for or select from a list

I personally like the "search button" method. I am sure others memebers of TSDN will have other ideas but if you would like to do this let me know and I can help you out.


Have a good one!
Aug 22 '07 #2
ali3n8
50 New Member
There are a couple different ways you can do this...

1.You can have text boxes where the users enter search criteria and then press a "search" button
2.You can have a combo box preform your search. The user can either type in what they want to search for or select from a list

I personally like the "search button" method. I am sure others memebers of TSDN will have other ideas but if you would like to do this let me know and I can help you out.


Have a good one!

Search Button is exactly what im looking for.
Aug 22 '07 #3
Stang02GT
1,208 Recognized Expert Top Contributor
Search Button is exactly what im looking for.

Ok well here is what you are going to need to do

Once you are have your form created with all the feilds you would like displayed, you are going to create a BOUND text box. (Bound means that it is connected with a feild in a table) in this example i will use LastName.

1.Once you have created your bound text box ( i can tell you how to do this if you don't know). You will wnat to create a blank button next to it.
2. Once you have created the button place this code in the "OnClick" event of the button. You are going to have to put the appropreate names in the corrisponding places

Expand|Select|Wrap|Line Numbers
  1. Private Sub ButtonsName_Click()
  2.    If IsNull(TextboxesName) = False Then
  3.       Me.Recordset.FindFirst '[FeildYourSearchingFor]=' & TextboxesName
  4.       Me!TextboxesName = Null
  5.       If Me.Recordset.NoMatch Then
  6.          MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
  7.             Me!TextboxesName = Null
  8.       End If
  9.    End If
  10. End Sub
This code will search, and if there is no result it will pop up a message telling the user there was not record found, and it will clear the txt box after the search is completed.
Aug 22 '07 #4
ali3n8
50 New Member
Ok well here is what you are going to need to do

Once you are have your form created with all the feilds you would like displayed, you are going to create a BOUND text box. (Bound means that it is connected with a feild in a table) in this example i will use LastName.

1.Once you have created your bound text box ( i can tell you how to do this if you don't know). You will wnat to create a blank button next to it.
2. Once you have created the button place this code in the "OnClick" event of the button. You are going to have to put the appropreate names in the corrisponding places

Expand|Select|Wrap|Line Numbers
  1. Private Sub ButtonsName_Click()
  2.    If IsNull(TextboxesName) = False Then
  3.       Me.Recordset.FindFirst '[FeildYourSearchingFor]=' & TextboxesName
  4.       Me!TextboxesName = Null
  5.       If Me.Recordset.NoMatch Then
  6.          MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
  7.             Me!TextboxesName = Null
  8.       End If
  9.    End If
  10. End Sub
This code will search, and if there is no result it will pop up a message telling the user there was not record found, and it will clear the txt box after the searc is completed.
Do I need to create a new table or can I just create a new form and label the text boxes on that?
Aug 22 '07 #5
ali3n8
50 New Member
How do I create a bound text box. I created a new text box on a form and it says unbound.
Aug 22 '07 #6
Stang02GT
1,208 Recognized Expert Top Contributor
To create a bound text box you are going to need to....

1. Right Click on the text box
2. Select Properties
3.Click on the Data tab
4. There should be a drop down with selections of the feilds in your table(if your form is bound to a table)

To bind a form to a table
1. In the properties menu for the Form do to the data tab
2.Click the drop down box and select the table you would like the form bound to
Aug 22 '07 #7
Stang02GT
1,208 Recognized Expert Top Contributor
If im not explaing things good enough here are a couple sites you can take a look at there are very good and provide a lot of detailed information about how to do things in Access

Search Form

How To Articles

More How To's
Aug 22 '07 #8
ali3n8
50 New Member
I created a form and dragged the fields I wanted to the form. I create the command button and also pasted what you gave me on clickevent. I get errors when I click the button.

MS Access can't find the macro 'private Sub ButtonsName_Cli ck() if IsNull(Contact Number)= False Then Me.
Aug 22 '07 #9
Stang02GT
1,208 Recognized Expert Top Contributor
I created a form and dragged the fields I wanted to the form. I create the command button and also pasted what you gave me on clickevent. I get errors when I click the button.

MS Access can't find the macro 'private Sub ButtonsName_Cli ck() if IsNull(Contact Number)= False Then Me.
Did you name the button "ButtonsNam e"?

Access names it by default something like" Command_15"
Aug 22 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7525
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and having the sql statement dynamically built according to the input provided by the user. I have used the method described here hundreds of times it is quick and adaptive. I generally use a frames page for the search, in this way the search is maintained...
1
1437
by: kevinray | last post by:
Hi, I have recently started to create an application which pulls data from our asset management database. I am using VB.NET 2003, and the data is on a SQL 2000 server. OS is 2K and XP. I want to create a form which I can have several text boxes which the user can input information to search on. e.g. put in partial asset number and obtain list of records which match the partial number, or person`s name and show all assets which that person...
16
1988
by: StephR | last post by:
Hello, the users on this site seem to be very helpful. I hope you guys can help me. I have been searching for the past 2 weeks on how to create a search form for my database at work. I'm not really experienced with working with code, although I have been able to pull a couple of them off. This is what I did: I have two databases my co workers use - one for the trackers and one for the shipping guy. (Since he has absolutly no computer...
2
2287
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2: MusicCategory - text Field 3: MusicCategoryAbbv - text Table 2 tblArtists Field 1 ArtistID - Auto Number (PK)
1
1705
by: pteargryphon | last post by:
I am creating a database of pavement conditions. I am trying to create a form for a user to be able to search the database based on 2 criteria, Route Number and Town Name. I have the form set up as 2 linked combo boxes, so when you select what route it gives you the possible towns. I want to be able to launch a seperate form, displaying details based on whats entered in these two combo boxes. As of now I can only create a command button to...
1
4833
by: NLR2008 | last post by:
Hi there, Can anybody help me and provide me with a SIMPLE solution to create a search form in Access 2003. I have created a database for Finance Payments and want to enable the user to search on a number of different fields and to return records that meet the criteria in a subform below. I'm testing this at the moment. So far i have: 3 unbound text boxes (to input the search parameters)
11
5587
by: woodey2002 | last post by:
This problem is driving me crazy. Hello there, i am trying to create a search form for records in my access database. The search form will contain text boxes and a multi select list box. The user can enter their search criteria eg. surname, reg num, etc. in the text boxes. The multi select list box allows the user to select multiple counties which they have the option of including in the search. The user should be able to select or omit the...
8
4519
by: munkee | last post by:
Hi everyone, I am using the following code adapted from Allen Browne: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few criteria as they wish, _ and results are shown one per line. 'Note: Only records matching ALL of the criteria are returned. 'Author: Allen Browne (allen@allenbrowne.com), June 2006. Option Compare Database
1
3411
by: rachbret | last post by:
Hi, I created a database with a table that has customer info - including sales history. I want to create a form so that i can search based on various criteria (first name, last name, purchase date, etc.). I was able to create a form and tried adding a command button to search records but it only looks at the field where my cursor is and only returns the first record that it finds. How can i add a search button that will search an entire...
0
8004
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8425
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8288
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.