Clear Button

Beany

Registered User.
Local time
Today, 23:10
Joined
Nov 12, 2006
Messages
155
i have a form that allows to add details to the table "tab_main".

ive got a clear button, it clears all textboxes apart from the textbox "date_issued". i get the following error message:

'Run-time error '2113':

The value you entered isn't valid for this field.'


Why am i getting this?

ive checked the table field and im inputting the right value!

in the command button under EVENT PROCEDURE, im using following code:


Private Sub Command25_Click()

Dim intResponse As Integer

intResponse = MsgBox("Are you sure you want to clear the text Boxs", vbYesNo, Change)

If intResponse = 6 Then
Me.number.Value = " "
Me.username.Value = " "
Me.cost_centre.Value = " "
Me.phone_model.Value = " "
Me.imei.Value = " "
Me.sim_no.Value = " "
Me.puk_code.Value = " "
Me.date_issued.Value = " "

Else

End If

End Sub


Help me!!!! thanks
 
Looks to me that your problem is the use of parenthesis " " with a date field. Do a search on date parameters or criteria you should find the answer.
 
try

username = NULL
cost_centre = NULL

and so on
 
First of all, to be clearing the textboxes, you want to use an empty string and not a space. So, you want
Code:
Me.number.Value = ""
instead of
Code:
Me.number.Value = " "
And to do dates, you can't set it to an empty string (nor with a space) so you have to set it to null
Code:
Me.date_issued.Value = Null
 
thank you buddies........

it works now!
 

Users who are viewing this thread

Back
Top Bottom