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

Search Form

Hi i hope someone help me on this..Im doing a search form..In my search form I have 7 fields to search these are:

caseID [textbox]
case Summary [combo box]
Resolution Summary [combo box]
Status Summary [combo box]
Escalated To [combo box]
Date From [textbox]
Date To [textbox]

When I want to search a record all the details will display in the subform..And also I would like to use any of the fileds above in searching..

please help me..i am new in using access database..


thank you in advance...

-cassey
Jan 18 '07 #1
6 2301
nico5038
3,080 Expert 2GB
When you know how to write VBA, then use stringing to build a filter like:

Expand|Select|Wrap|Line Numbers
  1. dim strFilter as string
  2.  
  3. strFilter = ""
  4.  
  5. IF len(nz(Me.Textbox1)) > 0 then
  6. ' textbox is filled
  7. strFilter = strFilter & " and textfield1='" & me.textbox1 & "'"
  8. endif
  9.  
  10. IF len(nz(Me.combo1)) > 0 then
  11. strFilter = strFilter & " and numfield1=" & me.combo1
  12. endif
  13.  
  14. ...etc.
  15.  
  16. ' Check filter is filled and strip off first " and " string
  17. IF len(strFilter) > 0 then
  18. me.subformname.form.filter = mid(strFilter,5)
  19. me.subformname.form.filteron = true
  20. else
  21. me.subformname.form.filteron = false
  22. endif
Getting the idea ?

Nic;o)
Jan 18 '07 #2
When you know how to write VBA, then use stringing to build a filter like:

Expand|Select|Wrap|Line Numbers
  1. dim strFilter as string
  2.  
  3. strFilter = ""
  4.  
  5. IF len(nz(Me.Textbox1)) > 0 then
  6. ' textbox is filled
  7. strFilter = strFilter & " and textfield1='" & me.textbox1 & "'"
  8. endif
  9.  
  10. IF len(nz(Me.combo1)) > 0 then
  11. strFilter = strFilter & " and numfield1=" & me.combo1
  12. endif
  13.  
  14. ...etc.
  15.  
  16. ' Check filter is filled and strip off first " and " string
  17. IF len(strFilter) > 0 then
  18. me.subformname.form.filter = mid(strFilter,5)
  19. me.subformname.form.filteron = true
  20. else
  21. me.subformname.form.filteron = false
  22. endif
Getting the idea ?

Nic;o)

Hi!tanx for the reply..im going to try this one..il update you once its done..tanx much!
Jan 19 '07 #3
Hi!tanx for the reply..im going to try this one..il update you once its done..tanx much!
Ive tried the code but its seems that it didnot work..when I want to search in combo box theres an error?can you please explain further?

thank you!
Jan 19 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Ive tried the code but its seems that it didnot work..when I want to search in combo box theres an error?can you please explain further?

thank you!
This code assumes your combo box has a number field as a unique identifier which would be standard practice. If however your combo box is bound to a text field then change the combo filter to the same as the previous textbox filter with the single quotes.

Mary
Jan 19 '07 #5
This code assumes your combo box has a number field as a unique identifier which would be standard practice. If however your combo box is bound to a text field then change the combo filter to the same as the previous textbox filter with the single quotes.

Mary

Hi can you give me an example??I am just new in doing database..How about the record source of my subform?
Jan 19 '07 #6
nico5038
3,080 Expert 2GB
The code was a sample for two types of information, text (needs surrounding single quotes) and numbers (no quotes needed). Date fields will need surrounding # characters and the fieldnames in the code were just a sample, you'll need to code an IF statement for every field/combo you have on your form and use the Name for the control on the form to make this work.

Just use the code to do the job for one field, test it and when it works add the next IF, etc. That way you can check when and where it goes wrong and we can assist you.

Nic;o)
Jan 19 '07 #7

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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.