SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inputbox not working help debugging?

    If I substitute ID with a real CLIENT_ID like 'Smith' it works but won't work with the InputBox statement. Help am going mad



    Sub OPEN_MATTERS_CLIENT_ID()

    ID = InputBox("Client ID?")


    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID ='ID'"


    With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Worksheets("Sheet4").Range("A2"), Sql:=strH)
    .Refresh
    End With

    End Sub

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Location
    OH, USA
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what property of InputBox you trying to access?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    South Africa
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if CLIENT_ID is a string

    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID ='" + ID + "'"

    or

    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID ='" & ID & "'"


    if CLIENT_ID is not a string

    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID =" + ID

    or

    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID =" & ID

  4. #4
    SitePoint Member
    Join Date
    Aug 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah this is the answer

    if CLIENT_ID is a string

    strH = "Select CLIENT_ID from MATTER Where CLIENT_ID ='" + ID + "'"


    Thanks!


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
  •