Link to home
Start Free TrialLog in
Avatar of txarli33
txarli33Flag for United Kingdom of Great Britain and Northern Ireland

asked on

DataGrid control

I want to display in a data grid control only the recordsets queried from a table and I want it to clear and display the new results when I do a new query.
The control is bound to the database's table ok, displays all the current data.
this is what I  got:
adodc's(in this case is called dcVideo) command is set to adcmdtext
Dim strSQL As String
 
  strSQL = "select * from films1 where "
  If strvalue = 1 Then
       If Option1.Value = True Then
     strSQL = strSQL & "year=2000"
      End If
      If Option2.Value = True Then
      strSQL = strSQL & "year>1989"
      End If
      If Option3.Value = True Then
      strSQL = strSQL & "year>1979 and year<1990"
      End If
      If Option4.Value = True Then
      strSQL = strSQL & "year<1979"
      End If
  ElseIf strvalue = 2 Then
      strSQL = strSQL & "oscar_award=A"
  ElseIf strvalue = 3 Then
      strSQL = strSQL & "categories=List1.Text"
  End If
  With dcVideo
      .RecordSource = strSQL
      .Refresh
  End With
for some reason it works fine when strvalue=1 but it doesn't work with the other two, everything goes fine until it gets to the refresh of dcvideo ("no value given for one or more parameters"), the string given to the recordsource is the right one.
Any idea please?(I'm going nuts)
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of txarli33

ASKER

I think you are right, strvalue =2 works now but strvalue =3 still doesn't, how can I change a string to a numeric value?
I love you,
it took me a bit to see the marks properly on the screen , that's why I sent that comment, but you were right.
Thanx, indeed
why a B ?