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
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!!!
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
Code:
Function messagebox()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you for Real want to delete This Records ?" ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Delete confirmations" ' Define title.
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenQuery "DeleteMytableName", acViewNormal
DoCmd.RunMacro "Confirmation"
Else ' User chose No.
Doc.RunMacro "Cancel"
End If
End Function
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!!!
Comment