How can I turn the Access Warning off

  • Thread starter new.microsoft.com
  • Start date
N

new.microsoft.com

How can I turn the Access Warning off for "The value you entered isn't
valid for this field" and set the field to be empty if user keyin wrong data
type for the field
 
B

Billy Yao [MSFT]

Hi,

Thank you for using MSDN Newsgroup! It's my pleasure to assist you with
this issue.

From your description, I understand that you would like to suppress the
error message and set the field to be empty if the entering data mismatches
the data type. Have I fully understood you? If there is anything I
misunderstood, please feel free to let me know.

If you'd like to perform this in a Table, I'm afraid there is no better way
except that you use the Volidation Rule and Volidation Text to notify
customer to enter the proper data. For a form, you can use VBA to suppress
this message with DoCmd.SetWarnings (False) and set the field to be empty
with Me.col1 = "". Additionally, you need to unbound that column first and
after that update the underlying table. Please see the following code and
apply on your side.

'''''''''''''''''''''''''''''''''''''''''''''''
Private Sub c2_AfterUpdate()

If Err.Number = 0 Then
Me.col1 = ""
End If

DoCmd.SetWarnings False
DoCmd.RunSQL "update table1 set col1 =" & """""" & " where ID = " & Me.ID
DoCmd.SetWarnings True

End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''

Does this answer your question? Please notify me if this helps resolves
your problem. If there is anything we can still assist you on this issue,
please feel free to let me know.

Best regards,

Billy Yao
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top