0

Helo friends;

If lbDriverName.SelectedIndex = True Then
            sql = "SELECT * FROM tblDriver WHERE dName =" & lbDriverName.SelectedItem
        Else
            sql = "SELECT * FROM tblDriver"
        End If

and my error is...

Syntax error (missing operator) in query expression 'dName ='.

where dName is the column in access table.
please hlp.
thanks

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by hisheeraz
0

Try

sql = "SELECT * FROM tblDriver WHERE dName ='" & lbDriverName.SelectedItem"'"

I think that should work - you have to have the whole statement surrounded by double quotes but to add the selected item I think you put it within double quotes within single quotes . . .

maybe this post helps:

http://www.daniweb.com/forums/post700733.html

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.