+ Reply to Thread
Results 1 to 3 of 3

Passing Paramaters

  1. #1
    Registered User
    Join Date
    02-28-2007
    Posts
    3

    Red face Passing Paramaters

    Hi Guys


    I'm trying to build a VBA program in Excel 2007.

    I have a SQL script pasted into sheet 1, and as part of that script (it's over 500 rows) there are parameters like ${Report_date}$, ${Month}$ etc, and I was wondering how I could pass this entire script through to the database (I have the database connection sorted).

    e.g

    Select * from Northwind
    Where period_date = ${Report_Date}$

    The above will be sitting in Cell reference A1 & A2.

    How could I pass that via VBA? and have the parameter recognized as the date?

    Hope someone can help.

  2. #2
    Registered User
    Join Date
    09-01-2012
    Location
    India
    MS-Off Ver
    Excel 2007/10
    Posts
    45

    Re: Passing Paramaters

    "Select * from Northwind where period_date between '"& Text(A1,"yyyymmdd") &"' and '"& Text(A2,"yyyymmdd") &"' "
    Last edited by pooja_deshpande; 10-05-2012 at 04:29 AM.

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Passing Paramaters

    It depends on your database, what are you using?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1