Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FP Update Handling Blank Form Fields with SQL

Status
Not open for further replies.

knoid

IS-IT--Management
Mar 17, 2001
3
US
Hi, I have created a web page that accesses an Access databse and everything works fine except one thing. If a form field is blank when someone has pulled up a record to edit, there is an ODBC error upon hitting hte update button. Now, there is a SQL statement written for it and it goes something like this:

UPDATE Results SET
LastName='::LastName::',
FirstName='::FirstName::',
MI='::MI::'

WHERE Email='::Email::'

Now, say the person doesn't have a middle initial, when updating the other information, if it is blank, the error occurs and the rest of the data is not updated. This isn't the only field left blank, and I'm currently working aorund it by forcing a dash to be put in each field by default. What sort of SQL statement will handle a blank field? I was thinking of trying to write one that checked to see if the field was empty and if so, then don't attmpt to update that field. Something like this:

UPDATE Results SET
{IF ('::LastName::' IS NOT NULL)
{LastName='::LastName::'}
ELSE {LastName='-'}},
FirstName='::FirstName::',
MI='::MI::'

WHERE Email='::Email::'


Thanks in advance for any help you can give.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top