Handle Warning POP UP in access 2013 via VBA code

Anonymous
2017-11-09T10:39:12+00:00

Hi expert, 

First of all sorry for my poor english. I'm a beginner in vba/sql programming and I have developed an application in access following Northwind database as example. The application works perfectly but how you can see from the image below when I try to copy and paste the entire row (CTRL+C then CTRL+V) into an empty record of the table, access always requests me to manage the following selection and always I have to select NO.  

How can I manage this exception in order to select always NO automatically and avoid the comparison of this pop up window?

I know the DoCmd.SetWarnings = False method but I don't think it is the best solution for my issue.

Do you know some libraries in access, suitable for handle exceptions or pop up like this via vba code?

nB: inside the pop up window is written: Number of record will be deleted: 1 - Clic on "SI" to delete these records....Do you want to continue? 

Thanks in advance

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. HansV 462.4K Reputation points MVP Volunteer Moderator
    2017-11-09T11:49:36+00:00

    The usual way to do this in VBA is by using DoCmd.SetWarnings False before such an action and DoCmd.SetWarnings True after it.

    Another way is to manipulate records in SQL using DAO or ADODB. Neither DAO nor ADODB asks for confirmation when you update, insert or delete records. But you have to requery the form afterwards.

    P.S. There are settings in File > Options > Client Settings for this:

    But these are user-level settings, not database-level settings. You shouldn't change those settings in your code.

    0 comments No comments
  2. Tom van Stiphout 40,091 Reputation points MVP Volunteer Moderator
    2017-11-10T03:00:49+00:00

    I'm not sure Hans hit the nail on the head. Maybe his Italian was failing him :-). It is VERY STRANGE that you would get a message about records being DELETED when INSERTING records.

    Are you getting the same message when entering a new row manually?

    Can you think of what is going on here that would cause records to be deleted?

    If you say Si - Yes, what records get deleted? If you don't know, write down the row counts of all tables before and after such operation.

    This is weird. I'm sure there is more to this story.

    0 comments No comments
  3. HansV 462.4K Reputation points MVP Volunteer Moderator
    2017-11-10T09:07:26+00:00

    I'm very bad at Italian... ;-)

    0 comments No comments
  4. Anonymous
    2017-11-10T09:31:30+00:00

    Hi Hans thank you for your answer. Unfortunately DoCmd.SetWarnings method select always "SI = YES" option so the application maybe try to delete the empty row of the form generating me an error.

    I cannot understand why in Northwind traders example when I add one or more record in the window below the app doesn't ask to delete rows, it just add the new ones without warning messages on the top of the empty row. I have copied the main functions 

    Probably I need to study more and find the differences between my app and Northwind 

    Don't worry for your italian I'm bad at english so we are balanced...However I think it's a good training for us :)...However if you have Northwind example in english, you can easily find the window I refer to and i have used as template for my application (see the image below)

    0 comments No comments
  5. Anonymous
    2017-11-10T09:45:19+00:00

    Hi Tom thanks for your reply. I have used the following window of Northwind example to build my application (sorry I have the only italian example)...However when I enter a new row manually the app works normally and it doesn't ask any message like Northwind.

    I think when I click 'Yes', the row that the app try to delete, is the last empty row.

    It's very complicated for me to explain the issue probably I haven't totally mastered Nortwind code (You know Northwind it's very tricky for a beginner) so I have to deeply study the difference between my app and the microsoft example...I will let you know...Thanks again

    0 comments No comments