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

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

thanks...solved with missing & sing in ur sql expression.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.