Create a Message Error when record not found

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!
 
S

Steve Schapel

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
 
D

Dreamer

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!
 
S

Steve Schapel

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!
 

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

Similar Threads


Top