473,666 Members | 2,010 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 1620
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
23861
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 converted the mdb to version 2002 under MS Access XP Polish and under this version everything works OK. The problem starts when I copy the mdb file to Windows XP EN and start it with MS Access XP EN. I get following error: "The expression On...
0
1807
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 OLEUnbound5 class Word.Document.8 I can embedd all other windows applications and i am running OfficeXP Developer The reason i want the word doc is i have hyperlinks that run to bookmarks on the page.. as i can not work out how to do this in a
1
14482
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 aggregate function, but there is no reference, at least that I can find anywhere, of how to do this. I have multiple lines fields for which I would like to do a "count distinct", but for simplicity, I am showing an example of only one field. Here is...
17
26533
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 Module. Here is the info on the Microsoft Access Module: Microsoft Access 2003 mdb is located at: C:\C#.NET\Esperanza The mdb is called: EspThr.mdb The Module is called: Module1 The function is: Public Function WriteHTML() As Integer The result...
0
3101
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 only last names first name based on that starting character. As the user type more characters the liestview should be updated. How can I write that routine? Thanks in advance,
10
32208
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 property setting produced the following error: A problem occured while Microsoft Access was communicating with the Ole server or ActiveX Control" I also get similiar errors On Load, On Click etc. with the same sentence
3
1903
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 this forum has been the only place I can find help, Usually sharp and to the point. As I would expect. The Access web ring just seems full of, well, advertising.
4
10357
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 this error but the fix did not pertain to this problem because the table or field name did not match any reservered Access words as described. My records search form will have two combo boxes and one or two search buttons. I am just trying to...
1
1623
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 If Not IsNull(txtSearchField12) Then GCriteria4 = GetResults(Me.txtSearchField12, "", Me.optSearch) If GCriteria = "" Then GCriteria = GCriteria4
1
4625
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 replace function to replace some text in the results. Access' REPLACE function is only available if executed within the environment, as it's a VBA function, not a SQL function. So how can I implement this is the EASIEST possible way? I don't to...
0
8445
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
8781
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
8551
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
8640
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
5664
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
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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.