p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   select statement with listbox item(where qnsID =" (http://p2p.wrox.com/showthread.php?t=32888)

Astro August 26th, 2005 02:31 AM

select statement with listbox item(where qnsID ="
 
I was advised on this.

select * from ans_table, ss_table where ss_table.qnsID = " & List1.ItemData(List1.ListIndex)

i'm a bit skeptical on how SQL joins with VBA using =" & (is it really meant to work?)
excuse my inexperience so please do correct me.

I kinda need to compare a listbox item to a column in my table.
Need some serious help.

Thank You very much.

Astro


danbush August 30th, 2005 05:58 PM

You should have an opening " mark as the one before the & is the end of the literal string and the & is joining the first part to the current value of the textbox item's itemdaa property. So, your whole select statement should look like this:

"select * from ans_table, ss_table where ss_table.qnsID = " & List1.ItemData(List1.ListIndex)

does this help?

arasu August 31st, 2005 02:12 AM

Ya it is working . & is the Concatenation operator in Vb. The field /column is not numeric then prefix with single quotes (') like as ( query field = '"& listbox &"'"

ok

Regards
Arasu.s



All times are GMT -4. The time now is 09:11 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.