473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Creating a Search Form in Access 2003

Hi there,

Can anybody help me and provide me with a SIMPLE solution to create a search form in Access 2003.

I have created a database for Finance Payments and want to enable the user to search on a number of different fields and to return records that meet the criteria in a subform below.

I'm testing this at the moment. So far i have:

3 unbound text boxes (to input the search parameters)

* TxtName (Name of Payee)
* TxtDate2 (Date)
* TxtInvoice (Invoice Number)

A sub form (frm_subformsearch) based on a query (qry_searchform) which gives me a list of all the records.

I'm basically stuck on the coding for selecting where the text boxes meet the criteria and returning these in the sub form.

I have downloaded a code from a website but it's not working - Can you tell me where i'm going wrong. Please note the code below is as was downloaded - i've not posted what i tried to do to tailor it to my database

Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim varColor As Variant
Dim varItem As Variant
Dim intIndex As Integer

varWhere = Null ' Main filter
varColor = Null ' Subfilter used for colors

' Check for LIKE First Name
If Me.txtFirstName > "" Then
varWhere = varWhere & "[FirstName] LIKE """ & Me.txtFirstName & "*"" AND "
End If

' Check for LIKE Last Name
If Me.txtLastName > "" Then
varWhere = varWhere & "[LastName] LIKE """ & Me.txtLastName & "*"" AND "
End If

Please help!

Thank you,

Nia x
Dec 17 '08 #1
1 4825
debasisdas
8,127 Expert 4TB
Why are you using > to compare string.
Need to use Length function instead.
Dec 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
6
by: Jules | last post by:
Hi: I have an Access 97 Search form set up - a couple of combo boxes, a couple of text fields and a command button. I want the command button to run an SQL script and then open the results form....
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
1
by: John T Ingato | last post by:
With excel VBA, I can do : Dim ctrGo as commandbutton Set ctrGo = me.controls.add("Go") which would create a button on the form. Can I do with with Access? When I try it, first of all the...
9
by: lightning | last post by:
Hi all, I'm not very conversant with the vocabulary of Access, so please ask for clarification if necessary... I am trying to build a search form that allows combinations of search terms. For...
3
by: erainc | last post by:
Hi There, I am trying to put a search box on my form in Access 2003. I tried doing it through a combo box, and the search part works, but the rest of the information on the form does not correlate...
3
by: teephish | last post by:
Hello, I'm currently in the process of creating a small access database and I'm having some problems with creating a customized search. I would like the user to be able to search a record by last...
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2:...
1
by: DeZZar | last post by:
For anyone that has the 'pleasure' of using Office 2007 you will know of one handy feature built in - its the search function housed in the record selector bar at the bottom of a form that allows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.