Thanks for this info.It helped me solve a problem.
Regards
Kevin
"John Blessing" <newsgroup.DeleteThis@LbeHelpdesk.com> wrote in message
news:37dss1F56k0irU1@individual.net...
>
> "Kevin Robinson" <k.s.robinson.DeleteThis@btinternet.com> wrote in message
> news:cus28v$1l6$1@titan.btinternet.com...
> > How do you include a variable in a select statement using VB6/Access.
> >
> > I want to do something like this :
> > SELECT * from A where A.field = variable
> >
> >
> > Thanks
> >
> > Kevin
> >
>
> dim strVar as string
> dim lVar as long
>
> strVar = "Hello"
> lVar = 10
>
> strql = "select col1, col2 from A where a.col1 = '" & strVar & "' and
> a.col2= " & cstr(lvar)
>
> Note:
>
> '" is single quote followed by double quote
> "' is double quote followed by single quote
>
> so that a ?strSql would give you
>
> select col1,col2 from A where a.col1='Hello' and a.col2=10
>
> <pedant>Database tables have columns, not fields. A field more properly
> refers to an input area on a user interface</pedant>
>
> Including the table name with the column name is not strictly necessary
when
> you are selecting from one table only.
>
> Also, never use select *. One day someone will add a blob column to your
> database and you will be retrieving massive data amounts when you don't
need
> it
>
> --
> John Blessing
>
> <a style='text-decoration: underline;' href="http://www.LbeHelpdesk.com" target="_blank">http://www.LbeHelpdesk.com</a> - Help Desk software priced to suit all
> businesses
> <a style='text-decoration: underline;' href="http://www.room-booking-software.com" target="_blank">http://www.room-booking-software.com</a> - Schedule rooms & equipment bookings
> for your meeting/class over the web.
> <a style='text-decoration: underline;' href="http://www.lbetoolbox.com" target="_blank">http://www.lbetoolbox.com</a> - Remove Duplicates from MS Outlook
>
><!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: SQL + Variables