Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit MSAccess Field in asp Page

Status
Not open for further replies.

Charlix

Programmer
Nov 19, 2002
85
US
I am trying to edit a field in an MS Acess database before the asp page sends it to the user.

rs = "(SELECT [Home Code] FROM {User Table]"
rs("Home Code") = 1

works, BUT if I try to make it general with code

rs = "(SELECT [Home Code] FROM {User Table]"
"rs(" & Chr(34) & "Home Code" & Chr(34" & ")" = 1

gives the Error Message = Expected Statement.

What am I doing wrong?

Charlix
 
It looks to me like your SQL is missing the WHERE keyword.


Perhaps you need the actual SQL statment to look like this:

SELECT [Home Code] FROM [User Table] WHERE [Home Code] = 1
 
My SQL statemebt is meant to call up the database. Then what I want to do is select the 'Home Code' field and edit it to where 'Home Code' = 1.

Thaks,
Charlix
 
What do you mean by "call up the database" ?

If you want to set a field named "Home Code" to 1 for every field in a table named "User Table" then you can do something like this:

UPDATE [User Table] SET [Home Code] = 1

If that is not what you are trying to do please give a more detailed explanation.
 
What I want to do is update only those 'Home Code' fields WHERE (SELECT clause meets certain criteria). For example,

rs = "(SELECT [User], [Home Code] FROM {User Table] WHERE [User] = 'Jim'"

I now want to edit the [Home Code] to 1, as follows

"rs(" & Chr(34) & "Home Code" & Chr(34" & ")" = 1

This is where I get the error message. It's the double parenthesis in rs("Home Code") that is causing the problem.

Charlix
 
Why not do it all in one step like this:

UPDATE [User Table] SET [Home Code] = 1 WHERE [User] = 'Jim'



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top