Click to See Complete Forum and Search --> : 2 Questions, Validate MaskEditBox & Edit DB record


aussiecyclone
April 8th, 2001, 12:55 AM
Hi,

Q1 From what I have read my code for edit in Q1 below should work, I’m missing something, the data is not being update My DB has a key field called ID.

Q2. How do I validate a MaskEditBox My code is below in Q2.

Any help appreciated.

Regards,

Alan.

Q1
Private Sub cmdUpdate_Click()
'Edit and save customer details
With Customers
.Edit
'Trap for null text boxes
If MaskABN.Text = "" Then
Customers.Fields("ABN").Value = Null
Else
Customers.Fields("ABN").Value = MaskABN.Text
End If

Customers("ABN") = MaskABN.Text
Customers("Telephone") = MaskTelephone.Text
.Update
End With
End Sub

End of Code

Q2.
‘I have a masked edit box that needs validating if a number is missed out.

Private Sub MaskABN_GotFocus()
MaskABN.Mask = "## ### ### ###"
End Sub

Private Sub MaskABN_LostFocus()
If MaskABN.Mask <> THE FORMAT OF THE MASK AND COMPLETE then
Msg “Do Something”
End Sub

vchapran
April 8th, 2001, 08:52 AM
Do validation in Validate event, trap blank this way:

private Sub MaskEdBox1_Validate(Cancel as Boolean)
If MaskEdBox1.ClipText = "" then
MsgBox "Box cannot be blank"
Cancel = true
End If
End Sub



Unfortunately, your other problems are unclear for me. Try to formulate them the different way.

Vlad