Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declare variables to a code? Pas Excel Discussion (Misc queries) 6 April 10th 10 01:14 PM
Inserting variables within file names kestrel Excel Worksheet Functions 3 June 16th 06 08:00 PM
Inserting and Formating Variables in a Header using a macro Strabo Excel Discussion (Misc queries) 0 March 14th 06 05:07 PM
Variables in VB Code David M Excel Programming 1 January 23rd 05 10:08 PM
Pass Variables into Form's code Stuart[_5_] Excel Programming 3 August 23rd 03 04:55 AM


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"