473,657 Members | 2,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1931
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******@NOyah oo.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
3032
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. ----------------------------------------------------------- --------------------- Access to the path "c:\inetpub\wwwroot\ProblemSolved\XMLData\Products.xml
9
4316
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"); for(i=0;i<50;i++){
27
5667
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 1K bytes of data. 3) These structs are to be used by all of the other 500K lines in various places.
11
26843
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 follows: private void SubmitButton_Click (object sender, System.EventArgs e) { // Set up the response to write the print file to the client Response.Clear (); Response.AppendHeader ("Content-Disposition", "filename=WebPrint.prn");
3
1328
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 could any please help me. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim frm As Form1 Dim text As String
0
1247
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 host. I deployed this by making 'Web Setup' project in VS.net and installing it on remote server which is Windows Server 2003. After installing it I could go to that page etc etc. Here is the error. I gave full access to ASPNET user via explorer....
2
2905
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
2353
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 not writing correctly. Please let me know what I can do to fix this.
20
3789
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 that particular key. Example:
1
3138
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 their paired "foreign" resx for that language only and installs those resource files in a subdirectory somewhere. I'm trying to create a setup project in visual studio 2008. Ive got my Application Folder set up with my executable. Im now...
0
8411
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.