Create a Message Error when record not found

  • Thread starter Thread starter Dreamer
  • Start date Start date
D

Dreamer

Hello everybody!

I have this code, and I need to Create a Message Error when record is not found


Private Sub SEARCHNroIPP_Click()

[NumeroIPP].SetFocus
DoCmd.FindRecord [TXTSEARCH], acEntire, , acSearchAll, , acCurrent, True

Exit Sub
End Sub


Thanks!
 
Dreamer,

Here's one possibility...

Private Sub SEARCHNroIPP_Click()
If DCount("*","YourTable","[NumeroIPP]=" & Me.TXTSEARCH)>0 Then
Me.NumeroIPP.SetFocus
DoCmd.FindRecord Me.TXTSEARCH, acEntire, , acSearchAll, ,
acCurrent, True
Else
MsgBox "No such numero"
End If
End Sub
 
THANKS A LOT Steve!!!

Other question ....

How I can change the Title of the Message Box?? The actual title is
"Microsoft office access 2003" ...... and the size of the msgbox
dialog???

A millon thanks!!!

Dreamer


Steve Schapel said:
Dreamer,

Here's one possibility...

Private Sub SEARCHNroIPP_Click()
If DCount("*","YourTable","[NumeroIPP]=" & Me.TXTSEARCH)>0 Then
Me.NumeroIPP.SetFocus
DoCmd.FindRecord Me.TXTSEARCH, acEntire, , acSearchAll, ,
acCurrent, True
Else
MsgBox "No such numero"
End If
End Sub

--
Steve Schapel, Microsoft Access MVP
Hello everybody!
I have this code, and I need to Create a Message Error when record is
not found
Private Sub SEARCHNroIPP_Click()
[NumeroIPP].SetFocus
DoCmd.FindRecord [TXTSEARCH], acEntire, , acSearchAll, , acCurrent, True
Exit Sub
End Sub
Thanks!
 
Dreamer,

MsgBox "No such numero", , "Your title here"

--
Steve Schapel, Microsoft Access MVP
THANKS A LOT Steve!!!

Other question ....

How I can change the Title of the Message Box?? The actual title is
"Microsoft office access 2003" ...... and the size of the msgbox
dialog???

A millon thanks!!!

Dreamer


Dreamer,

Here's one possibility...

Private Sub SEARCHNroIPP_Click()
If DCount("*","YourTable","[NumeroIPP]=" & Me.TXTSEARCH)>0 Then
Me.NumeroIPP.SetFocus
DoCmd.FindRecord Me.TXTSEARCH, acEntire, , acSearchAll, ,
acCurrent, True
Else
MsgBox "No such numero"
End If
End Sub

--
Steve Schapel, Microsoft Access MVP
Hello everybody!
I have this code, and I need to Create a Message Error when record is
not found
Private Sub SEARCHNroIPP_Click()
[NumeroIPP].SetFocus
DoCmd.FindRecord [TXTSEARCH], acEntire, , acSearchAll, , acCurrent, True
Exit Sub
End Sub
Thanks!
 
Back
Top