473,513 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Trigger "No Records Found" When There is No Records in .accde/.accdr?

132 New Member
Hi all once again!!!!
I have a database in .accde/.accdr format. The database has been designed using many relational tables.
I set a form for deleting some records or all database.
The problem is when you delete the records with action query it pop-up a message saying "you about to delete zero rows (0s)from-specified table" ten times for 5-relational tables. It is very annoying!
I know how to get read of this message and display a customer message as follows
Expand|Select|Wrap|Line Numbers
  1. Function messagebox()
  2. Dim Msg, Style, Title, Help, Ctxt, Response, MyString
  3. Msg = "Do you for Real want to delete This Records ?"    ' Define message.
  4. Style = vbYesNo + vbCritical + vbDefaultButton2    ' Define buttons.
  5. Title = "Delete confirmations"    ' Define title.
  6.  
  7. Response = MsgBox(Msg, Style, Title, Help, Ctxt)
  8. If Response = vbYes Then    ' User chose Yes.
  9. DoCmd.OpenQuery "DeleteMytableName", acViewNormal
  10. DoCmd.RunMacro "Confirmation"
  11. Else    ' User chose No.
  12. Doc.RunMacro "Cancel"
  13. End If
  14. End Function
  15.  
  16.  
It runs perfectly with DoCmd.RunMacro "Confirmation" as messagebox macro for confirmation and
Doc.RunMacro "Cancel" for cancellation.
The problem with this, once you select the record to delete, it keep deleting without giving any indication that there is no records in the database.
How to set the code above to search for presence/absence of records first before attempting to delete empty table regarding the following criteria???
1. If no records, then NO RECORDS FOUND message should be displayed without taking any further actions
2. If there are records on the related table then it should delete it with warnings as explained above

Happy X-Mas and New Year!!!
Dec 20 '11 #1
1 1972
NeoPa
32,557 Recognized Expert Moderator MVP
I suggest you open the record source (Table or Query) you want to delete from using a DAO.Recordset object and check for EOF. If EOF is already true then there are no records.

If the record source is either a table or a QueryDef (Not SQL), then you can use DCount() of it to determine if there are any records or not.
Dec 21 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2382
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
511
by: Ari Royce Hidayat | last post by:
Dear ALL, Is there some one ever faces this problem? And fix it? The scenario is: There's an html page that hosts a .net object (using object tag), and this page opens the second html page...
2
2088
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...
4
9518
by: amywolfie | last post by:
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. ...
2
3632
by: Paul T. RONG | last post by:
Hi, It is very strange. The mde works very well in Access XP but will get "Module not found" error when closing a form in Access 2k. I tried from yesterday evening to solve this prolem but in...
1
5710
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
2704
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...
3
3168
by: billelev | last post by:
I'm a relative newbie to java and have encountered a "source not found" error when trying to debug the following section of code (for the ParseException.class). public PaymentDates (String...
1
3742
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
2762
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
7257
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7379
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7521
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5682
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5084
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.