Filtering Form

Arg81

Well-known member
Joined
Mar 11, 2005
Messages
949
Location
Midlands, UK
Programming Experience
1-3
Something I posted before I went on holiday but had no replies to, I need some tips or pointers on the best way forward on a few things that are probably relatively simple, yet doing my head in.

1. I have a form for data viewing. The database has 10,000 + records. The users all have decided that they want to search either by ID or Customer.
What's the best way of doing this?
I'm thinking (correct me if wrong, or going wrong direction) that I need to create a SP for each search, so SP_getID and SP_getCustName.
Then I have a modal form for each SP which asks the user to input their selection of ID / Customer Name.
Once they have entered this and clicked btnOK on the modal form, it brings up the data viewing form with the filtered data.

I'm stuck at programming the button to do "Open frmInfo with the filtered data"

2. Another part which is confusing me - I'm designing the system as an MDI system, and the data viewing form is a child of the MDI parent with the menu. But if I've opened one of the modal forms (frmSearchID / frmSearchCustName) to ask the user for their input, when they click btnOK how can I tell frmInfo to open as a child of frmMain.

3. For frmSearchCustName, what I would like to do (this was easy in MS Access!!) is have the user select the customer from a combobox. Once they click btnOK, it does point 1 above.
This sounds stupid, but when the user selects the customer from the list and clicks them, is this stored so that the SP will take the value of combobox1.text as the parameter?

Thanks guys!!

Luke
 
I'm stuck at programming the button to do "Open frmInfo with the filtered data

If you use radio buttons (such as search by id and search by customer, this easy.
What I do is set a Public variable, such as sSearchBy
Then, you check which radio button is checked...

VB.NET:
If rbtnSearchById.checked = true Then
	 sSearchBy = "id"
Else
	 sSearchBy = "cust"
End If
' open frmInfo here

And then, on frmInfo load, you will check the value of sSearchBy like so

VB.NET:
If sSearchBy = "id" Then
	 ' select query for searching by id goes here
Else
	 ' select query for searching by customer goes here
End If
' data adapater fill command goes here

Hope This Helps
 
handy but not how I really want to do it.

I'm using MDI form, so I want the user to click on Search, then select a search method.

From these clicks I then want a modal form to appear which has the parameter, and when the user clicks GO, the main form is opened with data resulting only for that parameter.

At the moment I'm trying to test ID and CustomerName, but the users also want Keyword search and between dates search.

Thanks for the help,
Luke
 
not to worry, got this sorted out now.

Can someone just confirm that when using a parameterised query, you then have to parameterise all tables related to the one you are parameterising????
I.E. I have 3 tables - Tab1->Tab2->Tab3. Tab1 has the paraterised query, I've then had to add ID parameters to Tab2 and Tab3 otherwise I get a system error - ID not found...

Either way I've now got all my searches working!!
 
Back
Top