Clearing Data in Form question

SoxPats83

Registered User.
Local time
Today, 17:51
Joined
May 7, 2010
Messages
196
i have a DB with a form in it that has many text fields. i have a command button on this form that can clear all data entered in these text boxes, but not delete the record itself. below is an example of my VBA coding:

Private Sub Clear_Current_Record_Click()
Dim intResponse As Integer
intResponse = MsgBox("Are you sure you want to Clear all fields in current record?", vbYesNo, Change)
If intResponse = 6 Then
Me.Text1.Value = " "
Me.Text2.Value = " "
Me.Text3.Value = " "
Me.Text4.Value = " "
Me.Text5.Value = " "
Else
End If
End Sub

problem is, Text 5 is a date formatted field (__/__/____). i get a run time error of 2113, "The value you entered isn't valid for this field."

help on this problem would be appreciated.

Thanks!
 
For dates, it is either a date or NULL

Me.Text5 = Null

and you don't need the .Value part.
 
For dates, it is either a date or NULL

Me.Text5 = Null

and you don't need the .Value part.
thank you, that did it! BTW, i have a question posted over on that IIf function thread, if you don't mind taking a look boblarson.
 

Users who are viewing this thread

Back
Top Bottom