473,406 Members | 2,705 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,406 software developers and data experts.

Search Form..

Hi everyone..

i hope someone help me on this..

i need to do a search form..but apparently there are seven fields that they need to search..for example they can search a last name or first name...etc..

please help me plss....

any ideas??im having a hard time coding..as well as the trapping..

tanx so much!

cassey
Jan 10 '07 #1
7 1475
I assumed your using a bound forms. Bound your form on a query and put the below parameter on the Criteria Grid of each field or column you wish to search. But make sure the criteria are not on the same row. Each criteria should be on different row.

Like "*" & [Forms]![YourFormName]![YourSearchTextbox] & "*"

then put this code under AfterUpdate of YourSearchTextbox
me.requery

or put under click of a button (its your choice)

If youre using unbound forms then let me know. I can give you some idea too.

hth,
George





Hi everyone..

i hope someone help me on this..

i need to do a search form..but apparently there are seven fields that they need to search..for example they can search a last name or first name...etc..

please help me plss....

any ideas??im having a hard time coding..as well as the trapping..

tanx so much!

cassey
Jan 10 '07 #2
I assumed your using a bound forms. Bound your form on a query and put the below parameter on the Criteria Grid of each field or column you wish to search. But make sure the criteria are not on the same row. Each criteria should be on different row.

Like "*" & [Forms]![YourFormName]![YourSearchTextbox] & "*"

then put this code under AfterUpdate of YourSearchTextbox
me.requery

or put under click of a button (its your choice)

If youre using unbound forms then let me know. I can give you some idea too.

hth,
George
first thank you for the reply..i really appreciate it..

actually i am starting to do a search form but im still having more problems...first i need to query dates with ranges but the data type in my table is datetime..i dont know how will i format the dates.

cassey
Jan 10 '07 #3
Is this search form used only to filter the date?

Where you want format the date?




first thank you for the reply..i really appreciate it..

actually i am starting to do a search form but im still having more problems...first i need to query dates with ranges but the data type in my table is datetime..i dont know how will i format the dates.

cassey
Jan 10 '07 #4
Is this search form used only to filter the date?

Where you want format the date?
nop. actually they need to search by date or id number and other combo box..but i really need to filter the date..they need to search by date but the problem is my data type in database is date/time.

thank you so much..
Jan 10 '07 #5
Date/Time is the field of date and no other.

What I understand is, the value in your table is Date + Time (no pure date) If thats the case, Add one blank column to your query and put this on Field row:
PureDate:Format([YourDateFieldName],"dd/mm/yyyy") then search from this column.

in your search form, format also the date text box field search to ensure users input a valid date:

Properties:
Format: dd/mm/yyyy
Input Mask: 00/00/9999;0;_


you can change this as you like "dd/mm/yyyy"
d=day
m=month
y=year


HTH,
George




hth,
George




nop. actually they need to search by date or id number and other combo box..but i really need to filter the date..they need to search by date but the problem is my data type in database is date/time.

thank you so much..
Jan 10 '07 #6
NeoPa
32,556 Expert Mod 16PB
Nice work George.
In truth, there are special ways of dealing with Date/Time fields.
A trick I use to get a pure date, when necessary, is to say CDate(Int([DateField])).
If date literals are required then see (Literal DateTimes and Their Delimiters (#).).
In general, the way to have a multi-field search form is to have a form which is bound to the data source table/query but to have the search items as unbound controls (on the same form).
You would have a general purpose VBA routine to create a filter string. This routine would be called by each of the AfterUpdate event properties for the various search controls. Its job would be to create a string with SQL for all the search controls with valid data in them. The last thing it would include is some code running at the end to requery the form :
Expand|Select|Wrap|Line Numbers
  1. Call Me.ReQuery
Jan 10 '07 #7
How I forgot the CDate function?! silly George! thanks for the tip-trick chief!

Regards,
George



Nice work George.
In truth, there are special ways of dealing with Date/Time fields.
A trick I use to get a pure date, when necessary, is to say CDate(Int([DateField])).
If date literals are required then see (Literal DateTimes and Their Delimiters (#).).
In general, the way to have a multi-field search form is to have a form which is bound to the data source table/query but to have the search items as unbound controls (on the same form).
You would have a general purpose VBA routine to create a filter string. This routine would be called by each of the AfterUpdate event properties for the various search controls. Its job would be to create a string with SQL for all the search controls with valid data in them. The last thing it would include is some code running at the end to requery the form :
Expand|Select|Wrap|Line Numbers
  1. Call Me.ReQuery
Jan 11 '07 #8

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

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
1
by: bdawg | last post by:
what i want to do is create several radio buttons and a textbox for searching purposes. the search will perform a search depending on which button the user selects. here is what i have now: ...
1
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would...
9
by: Christopher Koh | last post by:
I will make a form which will search the database (just like google interface) that will look/match for the exact name in the records of a given fieldname. Any suggestions on how to make the code?
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
1
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and...
5
by: Fran Jakers | last post by:
Hello all, I'm new to all this and I could really use some help. I've searched the web but cannot find an answer. I have an HTML form with 3 radio buttons and a search field that calls a...
2
by: Mark | last post by:
Hi All, I am creating a music database for a friend and have run into a problem. Within the ALBUM table, I wanted to store the ARTIST_ID rather than the ARTIST_NAME. To do this, I intended to have...
12
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.