472,986 Members | 2,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,986 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 9432
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.