Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Help with Access 2003

Thread Tools
 
Search this Thread
 
Old 29 May 2006, 05:30 AM
  #1  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default Help with Access 2003

Hello

I have created a simple database (hahaha no such thing...) in Access for my CD collection. The table has 4 columns, MusicCollectionID, Title, Artist and Albumname. I created a form so that I can enter the information.

What I want to do is create some sort of a front end so that I can search the database for artist/title and get a list out. Dont want to have to create a report every time, as I have played with the report wizard and its a bit clunky for what I want.

Does anyone know how to do this ?

Thanks alot !!!

Dave (the insomniac)
Old 29 May 2006, 01:24 PM
  #2  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

Create a query including all of your fields, then in the fields you wish to search on enter this

Like [Enter Title To Search For] & "*"

The text can contain what ever you like, this is what it says on the screen when you run it. If you want to search on multiple fields simply enter the same code above in any of the fields in the query you wish to search on.

Next thing is to create a button on your form, right click the button and edit the properties and on the "on click" event enter this code.

Private Sub Command109_Click()
On Error GoTo Err_Command109_Click
Dim stDocName As String
stDocName = "Database Search"
DoCmd.OpenQuery stDocName, acNormal, acReadOnly


Exit_Command109_Click:
Exit Sub


Err_Command109_Click:
MsgBox Err.Description
Resume Exit_Command109_Click


End Sub

Command109 will be the name of your button, probably command1 in your case. "stDocName = Database Search" is the name of the query you created above. Call it what ever you like.

Hope this helps (and makes sense)
Old 30 May 2006, 09:52 AM
  #3  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Hi Bob

So I have gone to Queries and selected Create by using wizard. I selected all fields and clicked next. Then It gives me the options to open the query or modify the design. So i click open and I get a table of information, or modify and I get the query design. Is this where I put in the "Like" statement (in the criteria field) ?

I have created the button as you said and when I enter text to search for, whatever I put it comes back with nothing found. I also dont want to explicitly match the text I put in for the search, e.g. if I put "jackson" I want it to find Michael Jackson, Janet Jackson, Miss Jackson by Oukast, etc

Dave
Old 30 May 2006, 11:04 AM
  #4  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

edit the query in design mode and on the line where it says criteria paste the Like command against the fields you want to include on the search.

use this instead

Like "*" & [Enter Title To Search For] & "*"

the * eitherside will tell it to check anypart of the name so entering Jack will find Michael Jackson.

Old 30 May 2006, 11:18 AM
  #5  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

if you want to search on album artist or title it may be worth creating 3 queries and putting the Like command against the appropriate field.

Then create 3 buttons on your form, and change the docname as required

ie stDocName = "Query1"

then button 2 would saystDocName = "Query2" and so on

or insert whatever names you give the queries.

If you choose to go for the one click option then it will simply prompt you 3 times for the criteria, you can simply leave the boxes blank that you dont wish to search on, so Artist you would enter "Jackson", then the next 2 boxes that pop up asking you for title and albumname you can leave blank if you wish.
Old 30 May 2006, 12:31 PM
  #6  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Hi Bob

Am getting in a right pickle with this !!! I have created the 3 search buttons and when you click each one it comes up with the same ambiguous pattern error......will keep trying with it !!

Dave
Old 30 May 2006, 12:42 PM
  #7  
druddle
Scooby Regular
Thread Starter
 
druddle's Avatar
 
Join Date: Mar 2001
Location: Berkshire
Posts: 5,528
Likes: 0
Received 0 Likes on 0 Posts
Default

Right fixed that problem (typo !!)

I have got the 3 searches working, and if i search on artist for "Jackson" I get a load of results in a form But the form only has the artist column in it. Is there a way I can search on one column (like artist) but display all columns, so I can tell which titles and albums all the tracks by "Jackson" are ?

Dave

Trending Topics

Old 30 May 2006, 12:44 PM
  #8  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

It's the way I tell em

Upload it to some webspace or PM me and i'll take a look at it for you if you like
Old 30 May 2006, 12:48 PM
  #9  
bob269
Scooby Regular
 
bob269's Avatar
 
Join Date: Mar 2003
Posts: 2,654
Likes: 0
Received 1 Like on 1 Post
Default

Yup, make sure in your query you have all 4 fields selected with a tick.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
Primey
ICE
14
24 February 2017 12:46 AM
TylerD529
General Technical
2
09 October 2015 01:53 AM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM



Quick Reply: Help with Access 2003



All times are GMT +1. The time now is 03:31 AM.