Object required? tring to set varible to use with query

Discussion in 'ASP General' started by Abby Lee, Jul 28, 2004.

  1. Abby Lee

    Abby Lee Guest

    I hard coded "TheYear" (the table) and "MonthPD" (a field) into my
    script to make sure the query worked (it did)...so now I want to
    replace an actual year (table) with varible which the next step is to
    change from the web page.

    Switched
    "From AllExpenses2004" & _
    With
    "From " & TheYear & _

    Dim ThePD
    Dim TheYear
    'Set ThePD = 0604
    Set TheYear = "AllExpenses2004" '<-- Line 23

    sSQL = "SELECT *" & _
    " FROM " & TheYear & _
    " WHERE MonthPD = '0604'"
    set rs = Connect.Execute(sSQL)


    Error Type:
    Microsoft VBScript runtime (0x800A01A8)
    Object required: '[string: "AllExpenses2004"]'
    /eforms/reconcile/reconcile.asp, line 23

    What did I do wrong?
    Abby Lee, Jul 28, 2004
    #1
    1. Advertising

  2. Abby Lee

    Ray at Guest

    You only use SET when creating object variables, i.e.

    SET x = CreateObject("something")

    For strings, just do:

    TheYear = "AllExepenses2004"

    Ray at work

    "Abby Lee" <> wrote in message
    news:...
    >I hard coded "TheYear" (the table) and "MonthPD" (a field) into my
    > script to make sure the query worked (it did)...so now I want to
    > replace an actual year (table) with varible which the next step is to
    > change from the web page.
    >
    > Switched
    > "From AllExpenses2004" & _
    > With
    > "From " & TheYear & _
    >
    > Dim ThePD
    > Dim TheYear
    > 'Set ThePD = 0604
    > Set TheYear = "AllExpenses2004" '<-- Line 23
    >
    > sSQL = "SELECT *" & _
    > " FROM " & TheYear & _
    > " WHERE MonthPD = '0604'"
    > set rs = Connect.Execute(sSQL)
    >
    >
    > Error Type:
    > Microsoft VBScript runtime (0x800A01A8)
    > Object required: '[string: "AllExpenses2004"]'
    > /eforms/reconcile/reconcile.asp, line 23
    >
    > What did I do wrong?
    Ray at, Jul 28, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Cheshire [MSFT]

    RE: Take into a varible the HTML of a aspx page

    Jim Cheshire [MSFT], Oct 23, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    477
    Jim Cheshire [MSFT]
    Oct 27, 2003
  2. ad
    Replies:
    3
    Views:
    345
    Elton Wang
    Mar 18, 2005
  3. Marcio DeBarros
    Replies:
    0
    Views:
    372
    Marcio DeBarros
    Oct 2, 2003
  4. Replies:
    3
    Views:
    350
    Oliver Wong
    Nov 7, 2005
  5. Terry
    Replies:
    11
    Views:
    177
    Dr J R Stockton
    Sep 4, 2007
Loading...

Share This Page