473,385 Members | 1,736 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,385 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 2299
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.