Filling a datagrid with a query

Hi my names Mick,can somebody help me.

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

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

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"


  • You need to put the name of the Course within '' quotes.


    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.

Howdy, Stranger!

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


In this Discussion