Hi! I have this code in my program

sqlstat= "select bookNum from booktitle"
sqlstat2="select bookNum, bookName from booklist where bookNum not in " & sqlstat & "and bookAuthor like '" ListBook.SelectedItem & "'"

but it has "Incorrect syntax near the keyword 'and'" error...
please help me with this...
response is much appreciated... thanks :)

Put a space right before the AND

I already put a space but it's still the same

You're also missing an ampersand before ListBook.SelectedItem

thanks thines01... i did it this way

sqlstat= "select bookNum from booktitle"
sqlstat2="select bookNum, bookName from booklist where bookNum not in (" & sqlstat & ") and bookAuthor like '" & ListBook.SelectedItem & "'"

just missing some characters... thank you :)