View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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.