Results 1 to 3 of 3

Need help with VBA passing an argument

Threaded View

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    3

    Need help with VBA passing an argument

    I need help on passing a "person_id" from the application into VBA code below, please help: Here is what I am using but not working because my argument is not correct.
    Thanks!!

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Sub Auto_open() 
         
        Dim person_id As Double 
         
         
        person_id = "" 
         
        With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _ 
            "ODBC;DSN=ngdevl;Description=NGDevl;UID=sa;pwd="";APP=Microsoft Office 2010;;DATABASE=NGDevl" _ 
            , Destination:=Range("$A$30")).QueryTable 
            .CommandText = Array( _ 
            " select user_name, password,* from ngweb_bulk_enrollments a INNER JOIN person b ON b.person_id = a.person_id where b.person_id = '" + person_id + "'" _ 
    ) 
            .RowNumbers = False 
            .FillAdjacentFormulas = False 
            .PreserveFormatting = True 
            .RefreshOnFileOpen = False11 
            .BackgroundQuery = True 
            .RefreshStyle = xlInsertDeleteCells 
            .SavePassword = False 
            .SaveData = True 
            .AdjustColumnWidth = True 
            .RefreshPeriod = 0 
            .PreserveColumnInfo = True 
            .ListObject.DisplayName = "Table_Query1" 
            .Refresh BackgroundQuery:=False 
        End With
    Attached Images Attached Images
    Last edited by 6StringJazzer; 07-17-2014 at 08:04 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] ByRef argument type mismatch / Passing array as a function argument
    By pzling in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2012, 06:23 PM
  2. Passing an array as an argument
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-13-2009, 10:32 AM
  3. Passing a UDF as an argument to a UDF
    By puff in forum Excel General
    Replies: 3
    Last Post: 02-23-2006, 05:50 PM
  4. problem passing an argument to a sub
    By natanz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-16-2005, 04:05 PM
  5. Passing argument to another Sub
    By Roman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-01-2005, 06:06 PM

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