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

T

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 "".
 
R

Ray at

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
 
R

Roy in

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top