Passing VB control to SQL7 db field

We have a form that contains date fields in a SQL table.  The default for the field is null.  However, once a date has been entered in the field, you cannot remove the date without then pressing Ctrl+0 to set the field back to Null.  What commands could we use to send the Ctrl+0 to the field, and which area of the date field should we put it on (LostFocus, OnExit etc).
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1. set the focus to the control :
2. send the Ctrl+0 to the control :
   SendKeys ("^{0}"), True
julesuk71Author Commented:
We'll try your suggestion and get back to you for grading!
julesuk71Author Commented:
This is code we presently have on the Date Closed field:
Private Sub txtTaskDateClosed_lostfocus()
If txtTaskDateClosed = " " Then SendKeys ("^{0}"), True
End Sub

We have two screens - one is a summary screen, where you can select a particular record, then click a button which opens a Detail screen.  If you remove an entry from the date field in the Summary screen, it stays "gone", which is perfect.  However, if you remove the SAME date entry when you are in the Detail screen, when you return to the Summary screen, the date still appears in the field.

Any suggestions on this???
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

julesuk71Author Commented:
As we have several date fields that need the option of removing the date, it seemed silly that we should have to put code on each field to reset it to null.  There has to be a simpler and better solution than posting code on every date field that could be deleted.  
Set the dateformat field in VB for the textbox to DATE.  This will cause VB to pass a null date-type field to SQL, instead of a blank, unformatted field.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
julesuk71Author Commented:
Thanks, kbakst!  That suggestion did actually work perfectly!!!
if you set the forms' textbox to be bound to the rs field (date) as a date then when there is no date given the null value is therefore passed to you data-source else a date must be given.

good luck,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.