?
Solved

DataGrid control

Posted on 2003-02-19
4
Medium Priority
?
136 Views
Last Modified: 2010-05-01
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)
0
Comment
Question by:txarli33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 150 total points
ID: 7983319
Because Year is numeric and other fields are characters!

change to:

  ElseIf strvalue = 2 Then
      strSQL = strSQL & "oscar_award='A'"
  ElseIf strvalue = 3 Then
      strSQL = strSQL & "categories='" & List1.Text & "'"
  End If
0
 

Author Comment

by:txarli33
ID: 7983496
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?
0
 

Author Comment

by:txarli33
ID: 7983542
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
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7990637
why a B ?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question