There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash driver drivers error ethernet excel freeze games gaming hard drive hardware hdmi internet laptop lcd malware memory missing monitor motherboard mouse network printer problem ram random registry router slow software sound toshiba trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Access 2007 Search Form Problem

Reply  
Thread Tools
midnightcamaro69's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2010
31-Jul-2010, 10:45 PM #1
Access 2007 Search Form Problem
Hi, I am trying to learn Microsoft Access. I have made a database about some movies as an example. The thing is that I want to make a Search Form where the User types in the information he knows about a movie and the results show up listing possible Matches. I have found a few examples but they were made in 2003 and previous versions so there are some hidden tables which I cant see and none of the examples explain what they are doing.

I know there is a way to do it, I have uploaded the Zip file so please guide me step by step on how to make a Search Form.

Thank You Very Much.
Attached Files
File Type: zip DVD Database Zp.zip (48.4 KB, 49 views)
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,651 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
01-Aug-2010, 06:00 AM #2
midnightcamaro69, welcome to the Forum.
It shouldn't really matter whether the database is in Access 2000-2003 or Access 2007 as to whether you can learn from it.
I can recommend a good post to learn from as Computerman was learning about Access and created the same kind of database, you can find it here http://forums.techguy.org/business-a...-database.html

First of all you need to decide what sort of Search form you want, do you want one that is based on the normal Form(s) that you use for data entry?
Or do you want a separate search form that will display the results of your search and then maybe open a selected movie record, which is what Computerman's database does?

PS, I can't open Access 2007 databases.
__________________
OBP
I do not give up easily
midnightcamaro69's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2010
01-Aug-2010, 06:59 AM #3
Hi OBP, Basically I have set out a table which has all the fields and stores the actual Data. One of the forms I have created by using the Form Wizard will be used to add the information and another form created using the same method will be used to Search. Now I have added the desired Text Boxes that build up the criteria for search and a search button. I am now in the Visual Basic Viewer and on the event Button_Onclick. I have no idea what code I should put in, I do know some bits about visual basic but I have no idea what I need to put down in the code section. I dont know whether I should use this method or put the Table inside the search form as a subform.

I have used something like this in my code:

Dim varCrt as String

varCrt = Me.txtName.value (txtName is the textbox for Search Criteria)

Me.Filter = varCrt
Me.FilterOn = True

The above code does nothing, sometimes it makes all the fields that display the records blank or gives me an input box saying Add Parameters for txtName.

Thank you.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,651 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
01-Aug-2010, 08:51 AM #4
Is the Search form is "Bound" to the table, ie is the table the Record Source for the Form?
If it is you will need to set the Form's Filter as you are trying to do.
If it isn't, it best to use either a Query to filter the data or a VBA SQL generated query.

To set the form's Filter you use this kind of Format
Dim testdate As Date
testdate = Format(Date - 1, "mm/dd/yyyy")
Me.Filter = "[Customer Name] = 'Elie' AND [EntryDate] = #" & testdate & "#"
Me.FilterOn = True

Note the fact that you have to equate a Field with your Text String so if your record name field is called "FirstName" you would use
Me.Filter = "[First Name] =" & carCrt
or
Me.Filter = "[First Name] =" & Me.txtName
__________________
OBP
I do not give up easily
midnightcamaro69's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2010
01-Aug-2010, 10:49 AM #5
Yes I believe it is bound to the table because when I used the form wizard I selected tbldvd(which is the actual data table) from the drop down box in the wizard and then I selected the fields I wanted on the form from the list it gave me where you click the arrow to send the Field onto the right column from the left one. What method would you suggest for me to use to achieve what I am trying to do ?

I replaced "FirstName" with "Movie Name" as that is the field but then it gives me an error with the "end" and "debug" button saying: Syntax error(missing operator) in query expression '[Movie Name]=Iron Man2

this is the code I used: Me.Filter = "[Movie Name] =" & Me.txtName where Movie Name is the Field on my form that displays the data from the table and it is a Field in the Table.

I am quite new to Access so I am confused, sorry about that.

Thank you.
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,651 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
01-Aug-2010, 10:55 AM #6
That is OK, it is the torture of VBA Syntax.
Try this instead
Me.Filter = "[Movie Name] ='" & Me.txtName & "' "
That puts a pair of ' around the Text field which is the same as a pair of ".
You can also try
Me.Filter = "[Movie Name] =" chr$(32) & Me.txtName & chr$(32)
and
Me.Filter = "[Movie Name] = """ & Me.txtName & """ "
__________________
OBP
I do not give up easily
midnightcamaro69's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2010
01-Aug-2010, 11:08 AM #7
It is working Now, I put in Iron Man 2 and it shows a record of Iron Man 2 but the thing is I have to type in the Exact value in the field to get that result, is there a possible way to make it search for matching terms ? For Example the database has only got data for Iron Man 2 so if I type in "Iron Man" it should find the matching Iron Man 2 record.

I used the code: Me.Filter = "[Movie Name] = """ & Me.txtName & """ "
Me.FilterOn = True

Thank you OBP
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,651 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
01-Aug-2010, 12:05 PM #8
To do pattern matching you use
Me.Filter = "([Movie Name] Like ""*" & Me.txtName & "*"")

That will also find Man or 2 form the title.
CarltonCalv's Avatar
Junior Member with 1 posts.
 
Join Date: Aug 2010
02-Aug-2010, 05:43 AM #9
First you will need to chande the join type between Progress and [Planned Cost] to be the typoe that included all record from Progress and only the maqtch from
Next change your expression to be:
Nz([Planned Cost.Total_Amount],0)-[Actual Cost.Total_Amount]

NovelAspect is trusted by small businesses and accountants as an industry leader for quickbooks hosting. Your small business or accounting firm will have simplified access to Quickbooks at the lowest cost offered by any national QuickBooks Hosting provider.
midnightcamaro69's Avatar
Junior Member with 5 posts.
 
Join Date: Jul 2010
03-Aug-2010, 05:35 PM #10
thanks alot OBP, you are a genius thanks for your help it works
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
Solved: Access 2007 - Print single record selected on continuous form MuddyTurtle Business Applications 2 30-Jun-2010 04:43 PM
Access 2007 open forms with button and find specific data to display Botanist All Other Software 0 03-Mar-2010 11:26 AM
Access 2007 - searching for specific record in two forms strods Business Applications 3 12-Jul-2009 04:31 PM
Solved: Access 2007 Alphabetic Sort Problem look_b4u_leap Business Applications 8 29-Jan-2009 11:49 AM
Solved: Access 2007 - Form Tabs Problem look_b4u_leap Business Applications 4 06-Jan-2009 05:00 PM


Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:00 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.