473,322 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Object required? tring to set varible to use with query

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?
Jul 19 '05 #1
1 4096
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" <ab*******@hotmail.com> wrote in message
news:80**************************@posting.google.c om...
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?

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Drew McCormack | last post by:
I have a C++ template class which contains a static variable whose construction registers the class with a map. Something like this: template <typename T> class M { static Registrar<M>...
14
by: Oleg | last post by:
Hello there: I've been trying to create two different sets of required fields in one form and to use a radiobutton as sort of a switcher between these sets. In my HTML form there are two...
1
by: Peter | last post by:
Does anybody know how to convert a string to a varible? For example, I have defined 2 structures Structure SS dim Name as string dim ID as short end structure Structure TT
2
by: Aido82 | last post by:
Hi, this is probably a stupid question. Im trying to declare a varible to have the value of that in a text box when i declare the varible is there a way to give it the value in a text box...
5
by: atyndall | last post by:
OK, Well I've got this script and I'd like to implement this function into it where a function retrieves a specified amount of data from a specific mysql database, rearranges a part of it, and...
3
by: Sachin | last post by:
Hi Folks, I have one query in regarding const varible interpretaion by C/C++ compiler. How Compiler actually differentiate between normal stack varible and const varible during program execution?...
1
by: subodh1983 | last post by:
Hi, I would be glad if anybody can solve my problem. I have query to be run which requires a linked server to be accessed. Therefore I am using openquery. Now in the storedprocedure I pass...
1
by: ced69 | last post by:
having trouble getting marquee to work get object required errors tring t <title>This Month at the Chamberlain Civic Center</title> <link href="styles.css" rel="stylesheet"...
11
by: dougmeece | last post by:
Good Morning Experts, I spent all weekend working on this and got absolutely no where. I have a database with an input form that runs an append query to append to a table. Form Name: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.