Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Filling a datagrid with a query

mickydmickyd Member Posts: 2
Hi my names Mick,can somebody help me.

Dim strQuery As String
strQuery = "SELECT * FROM ScoresTable WHERE Handicap <= 16"
Adodc1.RecordSource = strQuery
Adodc1.Refresh

Dim strQuery As Variant
strQuery = "SELECT * FROM ScoresTable WHERE CourseName = Hertfordshire"
Adodc1.RecordSource = strQuery
Adodc1.Refresh

Why does the first query get the result i want,the second one i get a message saying "No value given for one or more parameters"
thanks

Comments

  • WEBMASTERWEBMASTER Member Posts: 549
    You need to put the name of the Course within '' quotes.

    like

    strQuery = "SELECT * FROM ScoresTable WHERE CourseName ='Hertfordshire'"

    Or use Parameters, then you will make your query safer and also protected against '' issues like this.



    Tore Nestenius
    [blue][italic][b]/WEBMASTER[/b][/italic][/blue] Programmers Heaven
Sign In or Register to comment.