ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inserting variables in code???? (https://www.excelbanter.com/excel-programming/337244-inserting-variables-code.html)

westg

inserting variables in code????
 
I have a problem trying to insert user input values in a where statement, the
user provides the data via a userform. numonth and nuyear are populated, i
them want to add these to the where statement as below -

Dim numonth As String 'numonth = 05
Dim nuyear As String 'nuyear = 5
"WHERE (VinstCoreData.ResDate= 50501 And VinstCoreData.ResDate<= 50531) AND
(VinstCoreData.PRG Like '%MOTIS%')" _

How can I insert the numonth and nuyear into the where statement??? Any ideas?

Thanks, Andrew.

Tom Ogilvy

inserting variables in code????
 
"WHERE (VinstCoreData.ResDate= " & nuyear & nymonth & "01 And
VinstCoreData.ResDate<= " & nuyear & numonth & "31) AND
(VinstCoreData.PRG Like '%MOTIS%')"

--
Regards,
Tom Ogilvy

"westg" wrote in message
...
I have a problem trying to insert user input values in a where statement,

the
user provides the data via a userform. numonth and nuyear are populated, i
them want to add these to the where statement as below -

Dim numonth As String 'numonth = 05
Dim nuyear As String 'nuyear = 5
"WHERE (VinstCoreData.ResDate= 50501 And VinstCoreData.ResDate<= 50531)

AND
(VinstCoreData.PRG Like '%MOTIS%')" _

How can I insert the numonth and nuyear into the where statement??? Any

ideas?

Thanks, Andrew.




Bob Phillips[_6_]

inserting variables in code????
 
"WHERE (VinstCoreData.ResDate= " & nuyear & numonth & "01 And " & _
" VinstCoreData.ResDate<= " & nuyear & numonth & "31) AND " & _
" (VinstCoreData.PRG Like '%MOTIS%')" _

--

HTH

RP
(remove nothere from the email address if mailing direct)


"westg" wrote in message
...
I have a problem trying to insert user input values in a where statement,

the
user provides the data via a userform. numonth and nuyear are populated, i
them want to add these to the where statement as below -

Dim numonth As String 'numonth = 05
Dim nuyear As String 'nuyear = 5
"WHERE (VinstCoreData.ResDate= 50501 And VinstCoreData.ResDate<= 50531)

AND
(VinstCoreData.PRG Like '%MOTIS%')" _

How can I insert the numonth and nuyear into the where statement??? Any

ideas?

Thanks, Andrew.





All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com