 |
|
 |
yronium Level: Moderator

 Registered: 14-04-2002 Posts: 907
|
Re: help! datagrid problem.
Hello. You have to think in a "recordset shape".
Your DataGrid control is linked to a recordset, isn't it? (Otherwise, why are you using a DataGrid?). So it should expose a Filter property. If you have set the DataSource property on the recordset, the control should be refilled automatically when setting the Filter property.
In the case you didn't link the control to a recordset (so, you should use a lighter control, instead) when you have filled the control you retrieved the values by a recordset, so you can Filter it. Or even, you can re-execute the query, adding combobox' parameter to the string instruction.
Retrieving the parameter from the combo is the simplest task: it's enough to set each entry's ItemData property when filling combo's list, then read it when selecting an item and pass the value to the query.
These are the steps to go, if you need more info post the code you use to fill the grid and the combo.
Hope it helps.
____________________________
Real Programmer can count up to 1024 on his fingers
|
|
08-09-2006 at 10:03 AM |
|
|
yronium Level: Moderator

 Registered: 14-04-2002 Posts: 907
|
Re: help! datagrid problem.
Well, you can try something like following:
| adodc.recordset.filter = "TypeOfSchool = " & Chr(39) & txtCriteria.Text & Chr(39) |
In this sample I'm using single quotes again, the two Chr(39)s, for string delimiter but in fact you have to choose the appropriate syntax, according with the db engine you work with.
Only, you have to carefully choose what event you put the filtering instruction in: in fact, selecting an item in a combo raises the ComboBox_Click event, in which you can put the code. I mean: a combo selection is completed raising one single event. With a textbox you can't put your instructions in the Change event, because this event is fired on every typing into it, so if you are typing e. g. the "Elementary" word, the event - and the code into it - is run ten times, nine of them with an incomplete criteria.
When working with textboxes, I usually wait user completes his input, and then explicitly run my instructions by a command button. So I put the code in the Click event of an explicit commandbutton.
Hope it helps.
PS: hey, admin: it took a dozen attempts to me to succeed to send this current reply. Did you know about this misworking? (However, it seems going on properly now...)
[Edited by yronium on 15-09-2006 at 09:50 PM GMT]
____________________________
Real Programmer can count up to 1024 on his fingers
|
|
15-09-2006 at 08:39 PM |
|
|
|
|
 |
 |