469,282 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

How to write back to Access-2000 Yes/No fields

Getting really stumped here.....

Using Classic.ASP and after an editing page has been completed I need
to write the values back to an Access 2000 database. But I'm battling
with a checkbox resultwhich has to be stored in aYes/No field.

I'm testing the variable no_mail to see if it returns "on" in ASP
which means the checkbox is ticked. I then load a variable called
sql_val_no_mail with the text that the SCP statement will use to
update into Access.

ie.
If no_mail = "on" Then
sql_val_no_mail = "Yes"

and then.....
" no_e-mail='" & sql_val_no_mail & "',"
goes into the SQL string

But what do you feed into Access for the Yes/No field to record a
positive

Tried: Yes "Yes" True "True" 1 "1" 0 "0" on

Any suggestions, please.....

thanks

.les.

Jul 22 '05 #1
3 1761
Les Juby wrote:
Getting really stumped here.....

Using Classic.ASP and after an editing page has been completed I need
to write the values back to an Access 2000 database. But I'm battling
with a checkbox resultwhich has to be stored in aYes/No field.

I'm testing the variable no_mail to see if it returns "on" in ASP
which means the checkbox is ticked. I then load a variable called
sql_val_no_mail with the text that the SCP statement will use to
update into Access.

ie.
If no_mail = "on" Then
sql_val_no_mail = "Yes"

and then.....
" no_e-mail='" & sql_val_no_mail & "',"
goes into the SQL string

But what do you feed into Access for the Yes/No field to record a
positive

Tried: Yes "Yes" True "True" 1 "1" 0 "0" on


-1 = true/yes/on
0 = false/no/off

Write the numeric value to the database field
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Les Juby wrote:
Getting really stumped here.....

Using Classic.ASP and after an editing page has been completed I need
to write the values back to an Access 2000 database. But I'm battling
with a checkbox resultwhich has to be stored in aYes/No field.

I'm testing the variable no_mail to see if it returns "on" in ASP
which means the checkbox is ticked. I then load a variable called
sql_val_no_mail with the text that the SCP statement will use to
update into Access.

ie.
If no_mail = "on" Then
sql_val_no_mail = "Yes"

and then.....
" no_e-mail='" & sql_val_no_mail & "',"
goes into the SQL string

But what do you feed into Access for the Yes/No field to record a
positive

Tried: Yes "Yes" True "True" 1 "1" 0 "0" on

Any suggestions, please.....

thanks

.les.


And stop using dynamic sql. use saved parameter queries (my preference):
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

or

ODBC placeholders (?) with an explicit Command object to pass the values to
the placeholders:
http://groups-beta.google.com/group/...e36562fee7804e

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #3
Oi, thanks for that help.!

I really do take your point about the horrors of dynamic SQL but this
site in particular is full of legacy code so we will have to keep it
in place. But I'm looking hard at switching to the parameter queries.

Main reason for my reply, especially if it can help someone else, is
that the real problem here was that I was using an illegal construct
in the field name. ie.
" no_e-mail='" & sql_val_no_mail & "',"

Once I changed the fieldname from no_e-mail to no_email then the 0 and
-1 was accepted fine.! This particular code is a construction of
backend code to replace manual maintenance of Access databases so the
problem never occurred when an Access Form was being used to update
details. We live and we learn......

Can't even begin to recount how many times I have hit major problems
because of reserved names for fields. Now I need to remember that a
hyphen should probably be always avoided in Access 2000 field names,
especially numeric field names.!

thanks again

.les.

On Sat, 11 Jun 2005 13:49:06 -0400, "Bob Barrows [MVP]"
<re******@NOyahoo.SPAMcom> wrote:
Les Juby wrote:
Getting really stumped here.....

Using Classic.ASP and after an editing page has been completed I need
to write the values back to an Access 2000 database. But I'm battling
with a checkbox resultwhich has to be stored in aYes/No field.

I'm testing the variable no_mail to see if it returns "on" in ASP
which means the checkbox is ticked. I then load a variable called
sql_val_no_mail with the text that the SCP statement will use to
update into Access.

ie.
If no_mail = "on" Then
sql_val_no_mail = "Yes"

and then.....
" no_e-mail='" & sql_val_no_mail & "',"
goes into the SQL string

But what do you feed into Access for the Yes/No field to record a
positive

Tried: Yes "Yes" True "True" 1 "1" 0 "0" on

Any suggestions, please.....

thanks

.les.


And stop using dynamic sql. use saved parameter queries (my preference):
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

or

ODBC placeholders (?) with an explicit Command object to pass the values to
the placeholders:
http://groups-beta.google.com/group/...e36562fee7804e

Bob Barrows


Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Peter Horwood | last post: by
9 posts views Thread by steph_de_marseille | last post: by
reply views Thread by berkeleydb_user | last post: by
2 posts views Thread by Alan T | last post: by
20 posts views Thread by Newbie Coder | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.