473,624 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create search form in Access

ashjones86
23 New Member
Hi All,

So im looking for some help with access 2007 if at all possible.
I am new to access as work has asked me to create a database, so the database side to it i have sorted i.e inputting data (google and youtube helped me with this).

But now i want to create a search function for inputted information.

In this instance, i want to be able to search 1 search term and get all the results linking to that, for example, i want to search a company car registration number and from that, i want the MOT, TAX, Service information that has been inputted, and from all the searches i have done, i cant find anything to help me with this.

If anyone could provide any assistance i would be truly grateful.

Thank you in advance.

Ash.
Jun 26 '14 #1
37 2538
jimatqsi
1,276 Recognized Expert Top Contributor
Welcome to Bytes.com.

Perhaps you will find this article helpful
http://bytes.com/topic/access/insigh...filtering-form

Jim
Jun 26 '14 #2
ashjones86
23 New Member
Hi Jimatqsi,

Thank you for that, in honesty that doesnt make much sense to me, again im very new to access, this is my first time using it, so in terms of where to enter code (vb is it?) i have no idea, if at all possible, if anyone can essentially hold my hand through it to give me the best understand of the steps to take, that would be great, ill continue to read that link, but gone through it a few times and im going in circles, thanks again though.
Jun 26 '14 #3
twinnyfo
3,653 Recognized Expert Moderator Specialist
Mods, forgive me for redirecting to a non-Bytes.com site....

There are other tutorials out there, but here is one: MS Access 2010 Tutorial.

I can do a lot of hand-holding on this forum, and I am willing to help as much as I can, but it looks like you need some basics first.
Jun 26 '14 #4
ashjones86
23 New Member
Hi Twinnyfo,

Thanks for that, i will have a look into it.

In terms of basics, i have gone through a lot, already completed the entry end of the data base, and i can filter results using the search facility the button creates, essentially ctrl F, but ive seen some scripts knocking about that pull data from various tables, originally posted on a topic from 2007 where someone had helped an individual out on the same issue, but it was for access 2003 and apparently it didnt cross over to 2007, sadly my post was deleted by mods for posting on a old topic ,hence this post.

So in some respects i have basic understandings, just getting lost with scripts.
Jun 26 '14 #5
twinnyfo
3,653 Recognized Expert Moderator Specialist
ash,

Do you know how to add any VBA to a form? In much older versions of Access, some of the wizards would create some basic code for routine operations, but now everything defaults to embedded macros, which are inherently limited.

If you have your DB open, hit Alt-F11 and this will bring up your VBA editor. It will probably be blank, as I can guess that you probably don't have any code.

To fix this, let's give you a basic introduction to VBA:

Open a form in design view (you can use an existing form or create a new one--it don't matter in this case). In the FOrm Design Tools Menu, on the Design Tab, select "Button" (a rectangle with "xxxx" in it). Click anywhere on your form, and a dialog box should pop up. Rather than using hte wizard, just click cancel. If the "Properties " list is not currently displayed for your button, right-click ont he button to bring it up.

On the Event Tab, in the On Click field, click on the Drop down and select [Event Procedure]. Then click the "..." to the right of the field. This will take you to your VBA editor. This is called a "module", so anytime anyone refers to a "module" you know what they are talking about.

The first thing I want you to do is to make sure that the following words are at the top of your VBA Code:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
If they are not, put them there now. Also, you will want to make sure these words are at the top of all of your modules by default, so in order to do this, click on the Tools Menu, then select Options. On the Editor Tab, make sure that all the checkboxes here are checked. Many of these are just useful tools, but hte most important one is "Require Variable Declaration". This means that in order for you to use any variables in your code, you must declare their existence somewhere before you can use them--this is just good programming technique, and I don't know a single coder out there who thinks that MS Access's default of having it turned off makes any sense!

Now, I can guess that the rest of your module looks similar to this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3. End Sub
Correct? Let's talk about this.

The word "Private" indicates the beginning of a set of code and also indicates that this code will only work within the confines of this Form's module. If you replaced this word with "Public", you could use the code elsewhere. Typically, we keep things on forms private, but there are cases in which things might need to be public, such as if you want to cal the code on one form from another. Not your concern right now.

The word "Sub" indicates that this is a sub-routine, which is a type of procedure. There is also "Function"--and some of the other big brains on the site may inform me that there are others, but I don't know of any. The big difference between a "Sub" and a "Function" is that a sub just executes code, whereas a Function can actually return a value for you. Other than that, they function identically.

The "Command0_Click " indicates several things. First, the "Command0" is the actual name of the control to which this code belongs. In this case, because it is a default-ly names command button, Access has named it "Command" and sequentially, starting from 0. If we were to do the same thing again, we would create a control called "Command1". Then a Text box and it would be called "Text2" (with an associated Label, called "Label3". A form can have a maximum of 1024 different controls over its lifetime. Believe it or not, I once had a form (or a report) that reached this max! If you don't actually have 1024 controls on a form, but have reached that max because of adding and deleting, you can just create a new form and copy all the controls over to it--more than you need to know right now, but just some more useless information....

The "_Click" indicates that this procedure executes when a user clicks on the control. Since this is a button, this makes sense. When we click a button, we want something to happen, right?

The "End Sub" is merely an indicator that the code should stop running and everything we want to accomplish is done.

Now, add the following into your code in the blank line before the "End Sub":

Expand|Select|Wrap|Line Numbers
  1.     MsgBox "It Works!"
Close your form and save it, and then double click to open your form. Click the button you just created, and you should get a pop up!

Here is your introductoin to VBA!

Now, back to your original question. It is nearly impossible for us to guide you through this without knowing something about your DB. It sounds like you know very little about DBs, which means your communication to us may be limited.

Keep in mind How to ask Questions and the Posting Guidelines as we work through this.

We will not just "do it for you" and we expect you to put forth some effort. Obviously you want a solution, and we can help you with that, but you should be doing the majority of troubleshooting . We can guide you to solutions.

Hope this helps, for now. Keep plugging away, and if you have a specific question we can work through, we can address that.
Jun 26 '14 #6
ashjones86
23 New Member
Before i continue my way though this, thank you for the effort you are putting in here, it is greatly appreciated, and im not looking for someone to make it for me, im a web developer, and know the frustrations of coding for someone, if i wanted that kind of service, i would pay a dev ;) , that said i want to learn vb and work my way through this, these guides written like this help me a lot and i extend my gratitude to you, shall continue working through this and get back to you, thanks again.
Jun 26 '14 #7
Slaxer13
106 New Member
Hi ashjones86.
I think this maybe is what you are looking for...
I found this when i was looking for my own db. Hope it helps you.
Cheers, Slaxer13
Attached Files
File Type: zip attachment.zip (23.8 KB, 96 views)
Jun 26 '14 #8
ashjones86
23 New Member
Hi Slaxer,

Shall take a look once i have worked through twinny's post, thanks very much mate :)
Jun 26 '14 #9
ashjones86
23 New Member
Hi Twinny, thanks again for that post, so i did as you said and my code looks like this
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4.  
  5. Private Sub Command17_Click()
  6. MsgBox "It Works!"
  7. End Sub
  8.  
Saved, closed and re-opened but no pop up, is it likely im missing something ?
Jun 26 '14 #10

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

Similar topics

7
3175
by: jim Bob | last post by:
Hi, This is probably very simple to do so if anyone can point me to the right place for reading, it would be much appreciated. I just want to build a very basic search form where i can enter a name or part of a name into a text box, press a button, and the entered value gets inserted into a sql query and the results of the query gets displayed into a list or text box. (ie take the input from the text box and plug that variable in my...
0
1242
by: _TeCk_ | last post by:
Do anyone know the name of the control : Search in Access. I want to know when the user leave the search form to refresh a subform. Thank's!
25
150733
by: ali3n8 | last post by:
Hello I would like to create a search form for my database that searches by: First Last Contact Number Street City State Zip
1
2701
by: hottoku | last post by:
Hi All, I'm having quite a bit of trouble designing a search tool to work with my database. I have found lots of examples from Microsoft Templates to Allen Browne's sample search form. The latter looks very promising, but I need to incorporate a combo box with "Nurse Care Managers" and have it filter by this. (Right now, I'm being asked to enter a parameter value and I can't figure out how to fix this.) I need to be able to search...
10
1646
by: ConfusedMay | last post by:
Hi, I'm kinda stuck right now with one of my forms and wondering if someone could help me with this. Basically what I need to create is a search form for users to be able to search using part Id or part Description. for example if user type in 10* in the part ID text box, then it should show all parts with part ID started with 10 in a data grid on the same form I have a form with txtpartID, txtDescription and search button. My question is...
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
4834
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)
6
3567
by: mercout | last post by:
Hey, I've been trying to create a search form in access for a while now, searching through books and emails. I have the search form set up with 11 combo box's, 3 text box's, a view button, and a clear button. Once the user enters certain fields, all of the boxes do not have to be filled and clicks the view button, a report will pop up with detail of what was found.I found this code...
9
1842
f430
by: f430 | last post by:
i have been trying to write a search code for a similar database, and i followed all the steps that were provided above, and my code was close to what lightning had but i have added date range in my search to search in between 2 dates, and i put this code in: If Not IsNull(Me.date1) Then strWhere = strWhere & "( >= " & Format(Me.date1, conJetDate) & ") AND " End If If Not IsNull(Me.date2) Then strWhere =...
0
8177
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
8681
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...
1
8341
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
8488
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...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
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
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
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...
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.