|
-
Dec 8th, 2003, 04:04 PM
#1
Thread Starter
Addicted Member
Database Search Please Help
Sorry about posting this again but my Question from a while back was not answered yet so I thought I’ll ask again.
I have a simple front End for an Access database and would like to include a Search option. I have looked in my books and did not find anything there. (well it’s probably there I just don’t see it) Also I am a beginner and am looking for some simple code I don’t need noting extravagant.
Could someone please help?
-
Dec 9th, 2003, 01:58 AM
#2
Thread Starter
Addicted Member
-
Dec 9th, 2003, 03:10 AM
#3
Fanatic Member
you need to decide which fields you are going to let people search on, add a text box for each one, and then build the SQL statement when they click the search button. Do this by checking to see if they have entered anything in each text box that they are allowed to search on.
It will invlove a lot of 'if' statements so be careful not to allow people to search on too many things.
-
Dec 9th, 2003, 11:42 PM
#4
Thread Starter
Addicted Member
This all sounds good but it sill don’t tell me how to implement the statements in my program. I would appreciate some guidance with a small code sample if at all possible, also, it is an ado database and I would like to be able to search only 2 of the fields but I don’t care if I could search all of them.
Thanks much!!
-
Dec 10th, 2003, 12:02 AM
#5
Frenzied Member
Dude thats easy. If you know how to write a query, then writing a search function should be no problem. This is what you need to do. Get the text from the text boxes for the field you want to search on then build the sql query. Execute that query against your DB table then populate your datagrid with the results.
-
Dec 10th, 2003, 01:51 AM
#6
Thread Starter
Addicted Member
That is what I'm trying to learn.
Id did not seem to difficult to build the database but when it came time to code the search I sort of hit a wall. If you look at the first post you will see where I’m saying that I’m new to programming. That is the reason I was asking for an example.
I’m looking in my book but I do not see “Sorry for asking Stupid Questions” just trying to learn.
I don’t do this full time like most people here, nor will I ever be good at this but I would like to learn how to create some small aps.
Thanks to anyone that is willing to lend a hand, the world needs more people that are willing to help each other.
-
Dec 10th, 2003, 03:23 AM
#7
Thread Starter
Addicted Member
This is what I "was thinking" the book said to do but it don't work?
Code:
If txtSCaseID.Text = "" Then Exit Sub Else
Resume
strSearch = Trim(txtSCaseID.Text)
OleDbDataAdapter1.SelectCommand.Parameters("Case ID").Value = strSearch
OleDbDataAdapter1.Fill(DataSet11.Bankruptcy)
DataSet11.AcceptChanges()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|