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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have these two snippets of codes. 1

Status
Not open for further replies.

EdRev

Programmer
Aug 29, 2000
510
US
I have these two snippets of codes. This gets executed when I try to update the database with my form. The access database fields days_booked is defined as number and accd_date is defined as date/time. When the txtDaysBooked.text is not empty then the field will be updated with its value but when it's empty the database field should also be blank (the same with mebADate). But this is not the case, even if the text fields are blank, the database fields get updated with some numbers. I tried this:
Else
adoRs!days_booked = ""
but I got a type mismatch error.


If Not (form.txtDaysBooked.Text = "") Then
adoRs!days_booked = form.txtDaysBooked.Text
Else
adoRs!days_booked = Nothing
End If

If Not (form.mebADate.ClipText = "") Then
adoRs!accd_date = form.mebADate.Text
Else
adoRs!accd_date = Nothing
End If

Any help will be greatly appreciated.
 
Do you have the Allow zero length property of that fields set to true?

If so then use that code and instead of making rsname!Field=Nothing do rsname!Field=Null

That's the only thing I can think of, if this doesn't work try to go line by line executing your code and see exactly what's happening.

Let me know if you need more help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top