Mike Online
  • Home
  • Vids & Photos
  • Guitar
    • Recordings >
      • My recordings
      • The CassTrators (MySpace)
    • Song chords >
      • Maggie May
      • Bob Dylan
      • Stars
      • Sunhee
    • Guitar tuner
  • Computing
    • QlikView
    • VBA & Excel
    • Visual Basic
    • SQL Server
    • Password Cracker >
      • ExcelFileHacker
  • Downloads
  • More...
    • Sidney Barrett
    • Wine >
      • Mr CCJ Berry - Blackberry Wine
      • Victory Blackberry Wine
      • Results
      • Links
    • Pottery >
      • Guides
      • Our Pottery >
        • Sunny's work...
        • Glaze - before & after
      • Links
    • Me... live
    • Jukebox
    • Education >
      • ESL
      • Academic writing
      • Korean
    • Calligraphy
    • TimesTables
    • App Dev
    • Links
    • Contact me

This code sets variables to define a time period (previous calendar month) dynamically changing the SQL statement sent to source

let vLastMonth = Year(AddMonths(now(),-1)) & '-' & num(month(addmonths(now(),-1)),'00') & '-01';
// This gets the first of the previous month
let vThisMonth = Year(now()) & '-' & num(month(now()),'00') & '-01';
// This gets the first of the current month

ODBC CONNECT TO MyDSN;

LOAD *;

SQL SELECT
DATE,
NAME,
CODE
FROM MyTable
WHERE DATE >= '$(vLastMonth)' AND
DATE < '$(vThisMonth)';



Picture
Powered by Create your own unique website with customizable templates.