Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 11th, 2005, 11:53 AM
Registered User
Join Date: Oct 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default entering Null value for Date field

I have a form to enter two date values into db. One of the date fields is optional.

How can I write an insert statement that allows an empty string or null value for courseDate2?

dim courseNumber as integer=dgCourseList.datakeys(e.item.itemindex)
dim courseDate as date=ctype(e.item.findcontrol("courseDate"),textbo x).text
dim courseDate2 as date=ctype(e.item.findcontrol("courseDate2"),textb ox).text

ourCommand= new odbccommand("UPDATE coursesInd SET courseDate='" & courseDate & "', courseDate2='" & courseDate2 & "' WHERE courseNumber="&courseNumber, ourConnection)

thanks in advance

Old January 12th, 2005, 01:29 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

I this code already inserts an empty string, right? Or do you get an error right now?

Otherwise, you need to do some If Then logic to determine the length of the text field. If the length is 0, then inset Null (without single quotes) instead of 'YourValue'.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy previous field record if next field is null ecampos Access VBA 6 June 23rd, 2006 12:55 PM
How to give Date format while entering date Subuana Beginning VB 6 4 March 17th, 2006 07:25 AM
Null Value for Date/Time Field ksegars4 Crystal Reports 2 November 17th, 2004 11:58 AM
Entering Date on web form mrideout BOOK: Beginning ASP.NET 1.0 6 October 19th, 2004 12:08 PM
Protect input-field from entering data rvw Javascript How-To 4 October 22nd, 2003 05:40 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.