+ Reply to Thread
Results 1 to 10 of 10

Pass Input Box VBA Variable to SQL Query

Hybrid View

  1. #1
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Pass Input Box VBA Variable to SQL Query

    You'll need to format it first, I think:
    sSql = sSql & "SET @DATE = '" & Format(report_date, "yyyy-mm-dd") & "'" & vbCrLf
    Everyone who confuses correlation and causation ends up dead.

  2. #2
    Registered User
    Join Date
    07-15-2010
    Location
    Omaha, Nebraska
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Pass Input Box VBA Variable to SQL Query

    Hi There!

    Thanks! It works like a champ! Really appreciate it.

    How about the totaling of the column? I want to put the total in cell C2. This is what I have now from recording a macro

    'Figure Totals here and put in cell C2
    .Range("C2").Select
    .Range("C2").Value = SUM(B2:B125)
    .Range("C3").Select

    The line where is says Value = SUM(B2:B125) gives me an error. It highlights the colon ":" between the two cell numbers.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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