Object required? tring to set varible to use with query

A

Abby Lee

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?
 
R

Ray at

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

SET x = CreateObject("something")

For strings, just do:

TheYear = "AllExepenses2004"

Ray at work
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top