Duane good answer, however, I have turned off any Access popup stuff. I want the user(abuser type) to be stopped from going any further so your suggestion aided me to try this which is working fine.
'
Private Sub txtFirstName_LostFocus()
If Mid(Me.txtFirstName, 1, 3) = "xxx" Then
MsgBox "Bad Name"xx
End If
'
--- In AccessDevelopers@yahoogroups.com, Duane Hookom <duanehookom@...> wrote:
>xx
>
> Where are you using this code? Is it in some before or after update event?
> I believe you could use the validation rule rather than code.
>
> Duane Hookom
> MS Access MVP
>
>
>
>
> To: AccessDevelopers@yahoogroups.com
> From: backyardautopart@...
> Date: Tue, 19 Jul 2011 03:21:45 +0000
> Subject: [AccessDevelopers] need a string function
>
>
>
>
>
>
> If Me.txtLastName = Left("xxx", 3) Then MsgBox "Not a good name", vbOKOnly + vbCritical, "Important Program"
> Me.txtLastName = Null
> Me.txtFirstName = Null
> End If
> If the user puts in 4x's then the Msgbox is bypassed by Access. I want the MsgBox to show up everytime.
>
Please zip all files prior to uploading to Files section.
Tidak ada komentar:
Posting Komentar