473,508 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Search Function in Microsoft Access

1 New Member
Firstly I am using Microsoft Access 2007

I am currently trying to build a database that can search through specific lessons learnt for a company. I have started by building a table, which includes Title, Project, Date, Summary, Category, Attachments and Key Words. Next I created a split form called Lessons Learnt List, which includes the table and at the top has a button called new lesson. When this button is pushed it is linked to another form which pops up and is called Lessons Learnt Details which allows new lessons learnt to be added to the table. The save and exit button work fine. A new form was created called Lessons Learnt Search, this is where I am having the problem. I have created a text box and linked it the table and then created a button. The button has been given the code:



Expand|Select|Wrap|Line Numbers
  1. Private Sub Search_Click()
  2.  
  3.    If IsNull(Title) = False Then
  4.       Me.Recordset.FindFirst '[Title]=' & Title
  5.       Me!Title = Null
  6.       If Me.Recordset.NoMatch Then
  7.       MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
  8.       Me!Title = Null
  9.       End If
  10.  
  11.     End If
  12.  
  13. End Sub
This is displaying an error, can someone tell me where I have gone wrong? What I want in this search form is the ability to type the Title, Project, Date, Key words and Category, or just one of the following and push the search button which would bring up the results on the Lessons Learnt List Form. The format I would prefer would be

Title: (then a blank box to type)
Project: (then a blank box to type)
etc

If there is a better way to do it, how do I do it?

Also the next thing I would like to do is have the ability in the search to type in part of a word, or just a single key word which would bring up the results? I saw somewhere this was done by using a *(and then the characters) before pushing a search button.

If not how would I do a search and list for my table, as in when I start typing the results start showing matches etc.

Thanks Very Much, Hope I was clear enough. If anything is unclear let me know!

Cheers
Jun 21 '12 #1
1 1613
Rabbit
12,516 Recognized Expert Moderator MVP
Please use code tags when posting code.

1) Strings have to be surrounded by quotes, either single or double.

2) Don't forget to escape quotes in your string.

3) I certainly hope your title textbox is an unbound control. Otherwise you are replacing the actual values in your tables.

4) You use the Key Press event to call your search code. And you use the wildcards with the LIKE operator.
Jun 21 '12 #2

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

Similar topics

3
23841
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have...
0
1798
by: DD | last post by:
I am trying to place a Word document into a form. I get the following error A problem occured while Microsoft Access was Communicating with the OLE or Activex Control the name of the ole is...
1
14466
by: nfrodsham | last post by:
In Microsoft's help literature, it states: "You can filter out non-unique rows by using the DISTINCT option of an aggregate function" I am trying to do this in Access 2003 with the COUNT...
17
26507
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
0
3086
by: Net | last post by:
Hi, I need to create a VB.Net search function against an Access database. When the user enters a character the function should search last name and the tree listview needs to be updated to show...
10
32171
by: Marcin Zmyslowski | last post by:
Hello all! I have a database created in MS Access 2003 which works fine in Win2000. This database shows me the following message in WinXP: "The expression On Load you entered as the event...
3
1891
by: ipellew | last post by:
Hi; I 'e been developing a little application based on MS Access (I am usually in Informix) and have to say the Web is full of sites that offer little in the way of help. I have to say that...
4
10355
by: dougmeece | last post by:
Hello everyone, I have created a search button but I receive the message "Microsoft Access can't fine the field "|" referred to in your expression" when I try to use it. I have looked online for...
1
1618
by: nik707 | last post by:
Hello all, I would like to develop a date search from Form in Access. Here is the sample of previous search coding I have developed used the help of experts on this forum. 'Approach to CSR...
1
4618
by: seanmatthewwalsh | last post by:
Hi I have a website that uses an Access 2003 database. I have controls on my pages that are bound to SqlDataSources that pull data from this database. In a couple of them, I need to use the...
0
7225
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,...
0
7124
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...
0
7385
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...
0
7498
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...
1
5053
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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...

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.