Pozdravljeni
Nasao sam ovaj kod za javljanje greske ako nisu upisani podaci. Kod odradi perfektno i javi mi da fale podaci ALI poslje toga se pojavi accessova poruka o gresci dali zelim upisati podatke.
MOJE PITANJE GLASI KAKO DA SE RIJESIM ACCESSOVE PORUKE
Gledao sam na forumu i na netu rad sa javljanjem gresaka ali mi nije jasno pa bi molio da mi kod ovog koda pomognete jer zelim da savladam to podrucje oko javljanja gresaka.
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Place an asterisk (*) in the Tag Property of the text boxes you wish to validate.
'Then in the BeforeUpdate Event of the form, copy/paste the following:
Dim msg As String, Style As Integer, Title As String
Dim nl As String, ctl As Control
nl = vbNewLine & vbNewLine
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag = "*" And Trim(ctl & "") = "" Then
msg = "Data Required for '" & ctl.Name & "' field!" & nl & _
"You can't save this record until this data is provided!" & nl & _
"Enter the data and try again . . . "
Style = vbCritical + vbOKOnly
Title = "Required Data..."
MsgBox msg, Style, Title
ctl.SetFocus
Cancel = True
Exit For
End If
End If
Next
End Sub
Puno pozdrava !!!
Nasao sam ovaj kod za javljanje greske ako nisu upisani podaci. Kod odradi perfektno i javi mi da fale podaci ALI poslje toga se pojavi accessova poruka o gresci dali zelim upisati podatke.
MOJE PITANJE GLASI KAKO DA SE RIJESIM ACCESSOVE PORUKE
Gledao sam na forumu i na netu rad sa javljanjem gresaka ali mi nije jasno pa bi molio da mi kod ovog koda pomognete jer zelim da savladam to podrucje oko javljanja gresaka.
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Place an asterisk (*) in the Tag Property of the text boxes you wish to validate.
'Then in the BeforeUpdate Event of the form, copy/paste the following:
Dim msg As String, Style As Integer, Title As String
Dim nl As String, ctl As Control
nl = vbNewLine & vbNewLine
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.Tag = "*" And Trim(ctl & "") = "" Then
msg = "Data Required for '" & ctl.Name & "' field!" & nl & _
"You can't save this record until this data is provided!" & nl & _
"Enter the data and try again . . . "
Style = vbCritical + vbOKOnly
Title = "Required Data..."
MsgBox msg, Style, Title
ctl.SetFocus
Cancel = True
Exit For
End If
End If
Next
End Sub
Puno pozdrava !!!