473,406 Members | 2,390 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,406 software developers and data experts.

I need help. I am having trouble clearing a field in an Access database.

Tim
I don't know what to use to clear a field in an MSAccess database. I
can update fields in the database and delete whole records but I have
not figured out how to clear a single field.

This is what I am using to update the database.

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DataBase"
SQL = "UPDATE Table SET "
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "

Set RSUpdate=Conn.Execute(SQL)
Conn.Close
Set RSUpdate=nothing

I get an error if I try to update a field with a value of nothing "".
Jul 19 '05 #1
4 2134
Either set it to '' or to null, depending on what you'd like.

UPDATE TheTable SET TheColumn='' WHERE Something=AcertainValue
or
UPDATE TheTable SET TheColumn=NULL WHERE Something=AcertainValue

Ray at work

"Tim" <la**********@yahoo.com> wrote in message
news:71**************************@posting.google.c om...
I don't know what to use to clear a field in an MSAccess database. I
can update fields in the database and delete whole records but I have
not figured out how to clear a single field.

This is what I am using to update the database.

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DataBase"
SQL = "UPDATE Table SET "
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "

Set RSUpdate=Conn.Execute(SQL)
Conn.Close
Set RSUpdate=nothing

I get an error if I try to update a field with a value of nothing "".

Jul 19 '05 #2
set it to null instead
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate=NULL "
SQL = SQL & " WHERE theName = '" & Request.Form("theName") & "' "

"Tim" <la**********@yahoo.com> wrote in message
news:71**************************@posting.google.c om...
I don't know what to use to clear a field in an MSAccess database. I
can update fields in the database and delete whole records but I have
not figured out how to clear a single field.

This is what I am using to update the database.

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DataBase"
SQL = "UPDATE Table SET "
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "

Set RSUpdate=Conn.Execute(SQL)
Conn.Close
Set RSUpdate=nothing

I get an error if I try to update a field with a value of nothing "".

Jul 19 '05 #3
As Ray and Roy said set it to null, but ensure that the field allows nulls.

"Tim" <la**********@yahoo.com> wrote in message
news:71**************************@posting.google.c om...
I don't know what to use to clear a field in an MSAccess database. I
can update fields in the database and delete whole records but I have
not figured out how to clear a single field.

This is what I am using to update the database.

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=DataBase"
SQL = "UPDATE Table SET "
SQL = SQL & "thefield='" & Request.Form("thefield1") & "', "
SQL = SQL & "theDate='" & FormatDateTime(Now,2) & "' "
SQL = SQL & "WHERE theName = '" & Request.Form("theName") & "' "

Set RSUpdate=Conn.Execute(SQL)
Conn.Close
Set RSUpdate=nothing

I get an error if I try to update a field with a value of nothing "".

Jul 19 '05 #4
Tim
Thanks for the info. I'll check things out and try the changes.
Jul 19 '05 #5

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

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
3
by: Raghuraman | last post by:
Hai I have a designed Crystal report .rpt file which has 4 access tables .. After designing the report i put a parameter field which filteres the desired records quite naturally. Every thing...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
6
by: Don Sealer | last post by:
I've written this expression for a DLookup function. It works almost alright. What I'm trying to do is type in a description and the ID field (number) populates automatically. It works almost as...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
20
by: d.s. | last post by:
I've got an app with two classes, and one class (InventoryInfoClass) is an object within the other class (InventoryItem). I'm running into problems with trying to access (get/set) a private...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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.