473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Custom "No Records Found" Message

I would like to put code behind a Find button on a form which:

1) Performs a find based on a field on the form
2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message box.

Thanks!!

amy
===
Nov 13 '05 #1
4 9480
Assuming you are using a recordset for the Find, use the following code:

If Rst.NoMatch Then
MsgBox "No Records Found"
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"amywolfie" <am*******@verizon.net> wrote in message
news:33**************************@posting.google.c om...
I would like to put code behind a Find button on a form which:

1) Performs a find based on a field on the form
2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message box.
Thanks!!

amy
===

Nov 13 '05 #2
I'm having problems with the recordset. The code below is not working:

Function NoRecordsFound()

On Error GoTo Error_Handler:

Set frm = Forms("frmFeeInput")
RecordsetClone.FindFirst
If (frm.RecordsetClone.RecordCount) = 0 Then 'this is where it dies
MsgBox "Record Not Found!"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
frm.SetFocus
End If

Exit Function

Error_Handler:
MsgBox Err.Description & Err.Number

End Function
=====

Thanks!

amy
===


"PC Datasheet" <no****@nospam.spam> wrote in message news:<8D******************@newsread3.news.atl.eart hlink.net>...
Assuming you are using a recordset for the Find, use the following code:

If Rst.NoMatch Then
MsgBox "No Records Found"
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"amywolfie" <am*******@verizon.net> wrote in message
news:33**************************@posting.google.c om...
I would like to put code behind a Find button on a form which:

1) Performs a find based on a field on the form
2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message

box.

Thanks!!

amy
===

Nov 13 '05 #3
am*******@verizon.net (amywolfie) wrote in message news:<33*************************@posting.google.c om>...
I'm having problems with the recordset. The code below is not working:

Function NoRecordsFound()

On Error GoTo Error_Handler:

Set frm = Forms("frmFeeInput")
RecordsetClone.FindFirst
If (frm.RecordsetClone.RecordCount) = 0 Then 'this is where it dies
MsgBox "Record Not Found!"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
frm.SetFocus
End If

Exit Function

Error_Handler:
MsgBox Err.Description & Err.Number

End Function
=====

Thanks!

amy
===


"PC Datasheet" <no****@nospam.spam> wrote in message news:<8D******************@newsread3.news.atl.eart hlink.net>...
Assuming you are using a recordset for the Find, use the following code:

If Rst.NoMatch Then
MsgBox "No Records Found"
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"amywolfie" <am*******@verizon.net> wrote in message
news:33**************************@posting.google.c om...
I would like to put code behind a Find button on a form which:

1) Performs a find based on a field on the form
2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message box.
Thanks!!

amy
===

The code you posted has a findfirst but no arguments after the find
first. If you look at help on find first you will see criteria is
required.

A String used to locate the record. It is like the WHERE clause in an
SQL statement, but without the word WHERE

Also the frm.recordsetclone.recordcount = 0 is incorrect for the form
data source more than likely has at least 1 record. You need ot use
frm.RecordsetClone.NoMatch = True to evaluate if a record was found

On Error GoTo Error_Handler:
Dim frm As Form
Set frm = Forms("form1")
RecordsetClone.FindFirst ("test = 'a'")
If (frm.RecordsetClone.NoMatch) = True Then 'this is where it dies
MsgBox "Record Not Found!"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
frm.SetFocus
End If

Exit Sub

Error_Handler:
MsgBox Err.Description & Err.Number
Nov 13 '05 #4
One question:

I would like to be able to perform a generic find in a field: in
other words, the user will not always be looking for a given value
each time, but different values every time.

It is possible to code this in VBA?

THANKS!

amy
===
dg*****@yahoo.com (dgs5150) wrote in message news:<52**************************@posting.google. com>...
am*******@verizon.net (amywolfie) wrote in message news:<33*************************@posting.google.c om>...
I'm having problems with the recordset. The code below is not working:

Function NoRecordsFound()

On Error GoTo Error_Handler:

Set frm = Forms("frmFeeInput")
RecordsetClone.FindFirst
If (frm.RecordsetClone.RecordCount) = 0 Then 'this is where it dies
MsgBox "Record Not Found!"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
frm.SetFocus
End If

Exit Function

Error_Handler:
MsgBox Err.Description & Err.Number

End Function
=====

Thanks!

amy
===


"PC Datasheet" <no****@nospam.spam> wrote in message news:<8D******************@newsread3.news.atl.eart hlink.net>...
Assuming you are using a recordset for the Find, use the following code:

If Rst.NoMatch Then
MsgBox "No Records Found"
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"amywolfie" <am*******@verizon.net> wrote in message
news:33**************************@posting.google.c om...
> I would like to put code behind a Find button on a form which:
>
> 1) Performs a find based on a field on the form
> 2) If NO RECORDS ARE FOUND, then displays a custom "No Records Found" message box. >
> Thanks!!
>
> amy
> ===

The code you posted has a findfirst but no arguments after the find
first. If you look at help on find first you will see criteria is
required.

A String used to locate the record. It is like the WHERE clause in an
SQL statement, but without the word WHERE

Also the frm.recordsetclone.recordcount = 0 is incorrect for the form
data source more than likely has at least 1 record. You need ot use
frm.RecordsetClone.NoMatch = True to evaluate if a record was found

On Error GoTo Error_Handler:
Dim frm As Form
Set frm = Forms("form1")
RecordsetClone.FindFirst ("test = 'a'")
If (frm.RecordsetClone.NoMatch) = True Then 'this is where it dies
MsgBox "Record Not Found!"
Else
frm.Bookmark = frm.RecordsetClone.Bookmark
frm.SetFocus
End If

Exit Sub

Error_Handler:
MsgBox Err.Description & Err.Number

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ziggi | last post by:
Hi ! I have an ISAPI instalation of PHP over IIS5 server on Windows 2000. Everything works fine but as I am under website development I would like to keep PHP error messages turned on - for my...
1
by: marks | last post by:
I get the same error trying to install any pear package if it's not alreay installed. # pear install Net_SMTP no signature found for package.info(string,string,bool) # pear -V PEAR Version:...
0
by: J. Muenchbourg | last post by:
I'm using and If with the BOF and EOF methods to start looping thru a group of records: If rstime.BOF and rstime.EOF Then response.write "There are no records!" <%Else%> <%If Not rstime.BOF...
2
by: amywolfie | last post by:
I would like to place a Find button on a form which uses the built-in Access Find facility. If no records are found, I would like to display a custom "no records found - plesae try again" message...
1
by: Kim | last post by:
How can I display "No data found" in the repeater if there are no records found after selecting an item from a dropdown list. Another question is: Can repeater perform paging as in datagrid if...
1
by: scottmachado | last post by:
I am currently running a marco that run a query and emails the results as an attachment in excel format. If the query has no records, I would like to email "no records found" in the first cell in...
11
by: CrostonScottish | last post by:
Can anybody help? I have this code i have put together so that when i select values for my combo boxes which are linked to values in lookup tables, it opens my "frmriskass" with only the...
1
by: RN1 | last post by:
Sub Page_Load(........) If Not Page.IsPostBack Then Call LoadData() End If End Sub Sub LoadData() Dim dSet As DataSet Dim sqlConn As SqlConnection Dim sqlDapter As SqlDataAdapter
1
by: Terry Archer | last post by:
Error 1 error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) #include <iostream> #include <fstream> #include...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.