473,587 Members | 2,579 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 "Confirmati on" 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 1979
NeoPa
32,566 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
2383
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: 1.3.3 PHP Version: 5.0.3 Zend Engine Version: 2.0.3
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 that also hosts a .net object (e.g. by click a hyperlink).
2
2095
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 which overrides the standard Access dialog. I do know how to turn Warnings on and off, just not how to code for a "No Records Found" on a button,...
4
9530
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. Thanks!! amy ===
2
3634
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 vain. Any help will be greatly appreciated. Thanks.
1
5713
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 the number of records to be displayed in too long ? I am using a repeater instead of datagrid as the latter does not allow me to have one...
1
2712
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 the excel attachment. I have a feeling that this needs to be done in VB, but I don't know that much about VB. Would using a report instead be a...
3
3180
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 stlDate, String matDate, int payFreq) throws ParseException { this.stlDate = Dates.convertStringToUSDate(stlDate); this.matDate =...
1
3747
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
2773
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 <iomanip> using namespace std; int main() { string lastName1, firstName1, lastName2, firstName2, lastName3, firstName3; double...
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.