Problem creating a search, in Microsoft 2007

CoreyBuchan

New member
Local time
Today, 12:37
Joined
Jun 21, 2012
Messages
3
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:



Private Sub Search_Click()

If IsNull(Title) = False Then
Me.Recordset.FindFirst '[Title]=' & Title
Me!Title = Null
If Me.Recordset.NoMatch Then
MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
Me!Title = Null
End If

End If

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
 
If you get an error then don't leave it to the reader to guess which error and in which line of code. Thats is a waste of effort.

Also, I'd recommend that you look up .FindFirst in the Help (select FindFirst and press F1) and on google for some examples of usage.

For searches tell .FindFirst what you are looking for
 
Apologies,

So when I type in a title and push the search button, it comes up with 'run time error 3001'

Invalid Arguement

When I push debug, it goes into Microsoft Visual Basic and the line
Me.Recordset.FindFirst '[Title]=' & Title is highlighted yellow.

I am trying to use the find first, however I am quite inexperienced with it.

Thanks
 

Users who are viewing this thread

Back
Top Bottom