Trying to create a search for a library database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I've been trying to do is create a search where a person can input a
title of a book and then it will come back telling you if the book is in the
list and if it is which library and which category it is under. I also want
this to be something I can link to on my switchboard. Can anyone help?
 
You need two tables that looks like:
TblCategory
CategoryID
Category

TblBook
BookID
BookTitle
CategoryID

Create a query named QryBookSearch base on both tables. Include the fields:
BookID
BookTitle
Category
Set the Sort for BookTitle ascending.

Put the following expression in the criteria of BookTitle
Like "*" & Forms!FrmSearch!SearchForTitle & "*"

You need a form named FrmSearch.
1. Add a textbox named SearchForTitle to this form.
2. Put the following code in the AfterUpdate event of SearchForTitle:
Me!MyBookList.Requery
3. Add a textbox named BookCategory to this form.
4. Add a listbox named MyBookList to the form
a) Set the row source property of the listbox to QryBookSearch.
b) Set the bound column property to 1
c) Set the column count property to 3
d) Set the column width property to 0;1.5;0
5. Put the following code in the AfterUpdate event of MyBookList:
Me!BookCategory = Me!MyBookList.Column(2)

You will enter the title of the book you want to search for in
SearchForTitle. It doesn't have to be the full title. When you press enter,
the titles of all books that contain the words you entered in the textbox
will appear in the listbox. You will then be able to see if the book you are
looking for is in the database. When you select the book you are looking for
in the listbox, its category will appear in the BookCategory textbox.
 
I just wanted to say thank you for taking the time to type that all up. I
really appreciate it. I will try it later when I have a little more time.
Thanks again!!!
 
Okay I must be doing something awfully wrong. I did everything you typed and
I get this error when trying to perform the search.

The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object 'Me.'.
* The expression may not result in name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

Do you have any ideas what I need to do? I've been trying to figure it out
and I run into a brick wall every time. Thanks
 
Did you put an exclamation point afetr Me?

Open to a code window. Click on Tools - References in the menu at the top of
the screen. Does one of the references say "Missing"? If so fix.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


lilteddy78 said:
Okay I must be doing something awfully wrong. I did everything you typed and
I get this error when trying to perform the search.

The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object 'Me.'.
* The expression may not result in name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

Do you have any ideas what I need to do? I've been trying to figure it out
and I run into a brick wall every time. Thanks
Steve said:
You need two tables that looks like:
TblCategory
CategoryID
Category

TblBook
BookID
BookTitle
CategoryID

Create a query named QryBookSearch base on both tables. Include the fields:
BookID
BookTitle
Category
Set the Sort for BookTitle ascending.

Put the following expression in the criteria of BookTitle
Like "*" & Forms!FrmSearch!SearchForTitle & "*"

You need a form named FrmSearch.
1. Add a textbox named SearchForTitle to this form.
2. Put the following code in the AfterUpdate event of SearchForTitle:
Me!MyBookList.Requery
3. Add a textbox named BookCategory to this form.
4. Add a listbox named MyBookList to the form
a) Set the row source property of the listbox to QryBookSearch.
b) Set the bound column property to 1
c) Set the column count property to 3
d) Set the column width property to 0;1.5;0
5. Put the following code in the AfterUpdate event of MyBookList:
Me!BookCategory = Me!MyBookList.Column(2)

You will enter the title of the book you want to search for in
SearchForTitle. It doesn't have to be the full title. When you press enter,
the titles of all books that contain the words you entered in the textbox
will appear in the listbox. You will then be able to see if the book you are
looking for is in the database. When you select the book you are looking for
in the listbox, its category will appear in the BookCategory textbox.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


in
the also
want help?
 
I did put the exclamation poing after Me......no references are missing.
Talk about getting frustrated. I bet this is something easy too!!! Now I'm
getting this error.

Microsoft Access can't find the macro 'Me!MyBookList.'
The macro (or its macro group) doesn't exist, or the macro is new and hasn't
been saved.
Note that when you enter the macrogroupname.macroname syntax in an
argument, you must specify the name the macro's macro group was last saved
under.

PC Datasheet said:
Did you put an exclamation point afetr Me?

Open to a code window. Click on Tools - References in the menu at the top of
the screen. Does one of the references say "Missing"? If so fix.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


lilteddy78 said:
Okay I must be doing something awfully wrong. I did everything you typed and
I get this error when trying to perform the search.

The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object 'Me.'.
* The expression may not result in name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

Do you have any ideas what I need to do? I've been trying to figure it out
and I run into a brick wall every time. Thanks
Steve said:
You need two tables that looks like:
TblCategory
CategoryID
Category

TblBook
BookID
BookTitle
CategoryID

Create a query named QryBookSearch base on both tables. Include the fields:
BookID
BookTitle
Category
Set the Sort for BookTitle ascending.

Put the following expression in the criteria of BookTitle
Like "*" & Forms!FrmSearch!SearchForTitle & "*"

You need a form named FrmSearch.
1. Add a textbox named SearchForTitle to this form.
2. Put the following code in the AfterUpdate event of SearchForTitle:
Me!MyBookList.Requery
3. Add a textbox named BookCategory to this form.
4. Add a listbox named MyBookList to the form
a) Set the row source property of the listbox to QryBookSearch.
b) Set the bound column property to 1
c) Set the column count property to 3
d) Set the column width property to 0;1.5;0
5. Put the following code in the AfterUpdate event of MyBookList:
Me!BookCategory = Me!MyBookList.Column(2)

You will enter the title of the book you want to search for in
SearchForTitle. It doesn't have to be the full title. When you press enter,
the titles of all books that contain the words you entered in the textbox
will appear in the listbox. You will then be able to see if the book you are
looking for is in the database. When you select the book you are looking for
in the listbox, its category will appear in the BookCategory textbox.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


What I've been trying to do is create a search where a person can input a
title of a book and then it will come back telling you if the book is in
the
list and if it is which library and which category it is under. I also
want
this to be something I can link to on my switchboard. Can anyone help?
 
Nevermind......I figured it out......stupid stupid mistake. Guess being sick
and having a sick kid isn't a good combination for working on access!!!
Thanks for all your help!
 
You're not entering the code correctly in 2 and 5 under FrmSearch!

1. Open the form in design view
2. Open properties and click on the Events tab
3. Click on the white box where it says After Update
4. Click on the three dots that appear at the right
5. Select Code Builder in the dialog that appears and click OK
6. The code window will appear and there will be two lines that look like:
Private Sub SearchForTitle_AfterUpdate()

End Sub
Enter the code I gave you between these two lines.
7. Close the code window

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



lilteddy78 said:
I did put the exclamation poing after Me......no references are missing.
Talk about getting frustrated. I bet this is something easy too!!! Now I'm
getting this error.

Microsoft Access can't find the macro 'Me!MyBookList.'
The macro (or its macro group) doesn't exist, or the macro is new and hasn't
been saved.
Note that when you enter the macrogroupname.macroname syntax in an
argument, you must specify the name the macro's macro group was last saved
under.

PC Datasheet said:
Did you put an exclamation point afetr Me?

Open to a code window. Click on Tools - References in the menu at the top of
the screen. Does one of the references say "Missing"? If so fix.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


lilteddy78 said:
Okay I must be doing something awfully wrong. I did everything you
typed
and
I get this error when trying to perform the search.

The expression After Update you entered as the event property produced the
following error: The object doesn't contain the Automation object 'Me.'.
* The expression may not result in name of a macro, the name of a
user-defined function, or [Event Procedure].
* There may have been an error evaluating the function, event, or macro.

Do you have any ideas what I need to do? I've been trying to figure
it
out
and I run into a brick wall every time. Thanks
:

You need two tables that looks like:
TblCategory
CategoryID
Category

TblBook
BookID
BookTitle
CategoryID

Create a query named QryBookSearch base on both tables. Include the fields:
BookID
BookTitle
Category
Set the Sort for BookTitle ascending.

Put the following expression in the criteria of BookTitle
Like "*" & Forms!FrmSearch!SearchForTitle & "*"

You need a form named FrmSearch.
1. Add a textbox named SearchForTitle to this form.
2. Put the following code in the AfterUpdate event of SearchForTitle:
Me!MyBookList.Requery
3. Add a textbox named BookCategory to this form.
4. Add a listbox named MyBookList to the form
a) Set the row source property of the listbox to QryBookSearch.
b) Set the bound column property to 1
c) Set the column count property to 3
d) Set the column width property to 0;1.5;0
5. Put the following code in the AfterUpdate event of MyBookList:
Me!BookCategory = Me!MyBookList.Column(2)

You will enter the title of the book you want to search for in
SearchForTitle. It doesn't have to be the full title. When you press enter,
the titles of all books that contain the words you entered in the textbox
will appear in the listbox. You will then be able to see if the book
you
are
looking for is in the database. When you select the book you are
looking
for
in the listbox, its category will appear in the BookCategory textbox.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


What I've been trying to do is create a search where a person can input a
title of a book and then it will come back telling you if the book
is
in
the
list and if it is which library and which category it is under. I also
want
this to be something I can link to on my switchboard. Can anyone help?
 
Back
Top