From: Maracay on
Hi Guys,

I have this sql statement, it works but I want to display a message if the
record is not found and continue if record is found, my question is how can I
capture these events, I will really appreciate any help

Thanks

Set rs = db.OpenRecordset( _
"select JobName, DocketGenInfo " & _
"from tblMDocket " & _
"where DocketNumber = " & Me.ComboDocketRef)


From: PieterLinden via AccessMonster.com on
Maracay wrote:
>Hi Guys,
>
>I have this sql statement, it works but I want to display a message if the
>record is not found and continue if record is found, my question is how can I
>capture these events, I will really appreciate any help
>
>Thanks
>
>Set rs = db.OpenRecordset( _
> "select JobName, DocketGenInfo " & _
> "from tblMDocket " & _
> "where DocketNumber = " & Me.ComboDocketRef)

if rs.RecordCount = 0 then
MsgBox "no records"
end if

Where are you doing this? Some context would help a lot. If you are opening
a form or a report, you can use either the form's recordsetClone.RecordCount
or if it's a report, use the NoData event.

--
Message posted via http://www.accessmonster.com

From: Daryl S on
Maracay -

Test for the end-of-file right after your OpenRecordset. If it is true,
then no records were returned.

IF rs.EOF Then 'no records returned
<message here>
Else
<continue processing>
E
--
Daryl S


"Maracay" wrote:

> Hi Guys,
>
> I have this sql statement, it works but I want to display a message if the
> record is not found and continue if record is found, my question is how can I
> capture these events, I will really appreciate any help
>
> Thanks
>
> Set rs = db.OpenRecordset( _
> "select JobName, DocketGenInfo " & _
> "from tblMDocket " & _
> "where DocketNumber = " & Me.ComboDocketRef)
>
>
From: Jeff Boyce on
One way to do this would be to test the RecordCount for that recordset you
opened.

If the RecordCount is 0, no records were found...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Maracay" <Maracay(a)discussions.microsoft.com> wrote in message
news:9F3F5EAE-002A-4152-A734-71D1830BE6EC(a)microsoft.com...
> Hi Guys,
>
> I have this sql statement, it works but I want to display a message if the
> record is not found and continue if record is found, my question is how
> can I
> capture these events, I will really appreciate any help
>
> Thanks
>
> Set rs = db.OpenRecordset( _
> "select JobName, DocketGenInfo " & _
> "from tblMDocket " & _
> "where DocketNumber = " & Me.ComboDocketRef)
>
>


From: Afrosheen via AccessMonster.com on
Here's a routine I picked up from here that does what you want. I was having
the same problem.

If Me.RecordsetClone.RecordCount = 0 Then
Call MsgBox("Boo-hoo, no records found!", vbQuestion, Application.Name)
End If


Jeff Boyce wrote:
>One way to do this would be to test the RecordCount for that recordset you
>opened.
>
>If the RecordCount is 0, no records were found...
>
>Regards
>
>Jeff Boyce
>Microsoft Access MVP
>
>> Hi Guys,
>>
>[quoted text clipped - 9 lines]
>> "from tblMDocket " & _
>> "where DocketNumber = " & Me.ComboDocketRef)

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201003/1