473,397 Members | 1,969 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,397 software developers and data experts.

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 1916
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Peter Horwood | last post by:
I am having trouble writing an XML file out on my localhost development machine. I get: Server Error in '/ProblemSolved' Application. -----------------------------------------------------------...
9
by: steph_de_marseille | last post by:
I would like to write a x array in a file. If the array has a small numbers of columns I know I can use a loop like: int i,j; double array; FILE *file1; file1=fopen("data.dat","w");...
27
by: Sune | last post by:
Hi! Pre-requisites: ------------------- 1) Consider I'm about to write a quite large program. Say 500 K lines. 2) Part of this code will consist of 50 structs with, say, no more than at most...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
3
by: The One | last post by:
Have created a form to pop up with 2 option I then wish to write the text that is in the option button chose back to the original form using the code below but it gives me an exception error so...
0
by: berkeleydb_user | last post by:
Guys On my development machine I have a very simple app that takes input from user from asp, runs some macros in excel and spits out the result back on asp page. This works perfectly well on my...
2
by: Alan T | last post by:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="DataBaseConnection" connectionString="server=localhost;database=SalesDB;User
5
by: barnetod | last post by:
I am trying to open a text file designated by the user. Then I want to change all lower case values to capital letters. Then write file. I am stuck and can not change the characters or am...
20
by: Newbie Coder | last post by:
MFC Application VC++.NET 2003 I have a certain registry key (HKCU\Software\MyKey) that contains between 30 & 64 string values I need to write a '*' to all those 30 - 64 string values under...
1
by: Claire | last post by:
Ive written a small string resource building utility that I send out to our translators. I have a setup project for each language we support, which picks out a group of 12 english resx files plus...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.