Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Unwanted records

    I have a data entry form. When opened it creates a new record by default. I have disabled the navigation buttons and form close buttons and put in my own command buttons. The user can click exit without saving and it will run a query to delete that record.



    However, If the whole database is closed and this form has been opened it creates a situation where we have blank records that will appear on reports and are useless.

    How could i prevent this?

    Thanks in advance.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    If the whole database is closed and this form has been opened it creates a situation where we have blank records that will appear on reports and are useless.
    ??? The database is closed and the form is open??? I'm missing something..

    Perhaps some routine on the database close that purges/deletes records that can be identified.

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    No thats right, the database can be closed with forms open at the time. This then bypasses all exit proceedures. Thats the issue.

    I cant stop someone closing the frontend of their database.
    I cant have a delete query on the close event of the form as this would happen on records we want to keep.
    I could add a message box to ask if they want to delete the record but this would happen every time and be confusing.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Are there multiple conditions here?

    User closes the front end, is not working with a form
    User closes the front end, is working with a form and has not completed the process
    User closes the form, but front end is still open
    others??

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Why don't you silently run the delete query to remove empty records when you open the application (in the OnOpen or OnLoad code of your opening form or with an AutoExec macro) and also in the Unload event of the main form. If you do not have a main/switchboard type form you can create a small form that you keep hidden and use its Unload event to run the delete.
    https://www.access-programmers.co.uk...-event.213758/
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Thank you. Most of the entry is automatic but i've made it so the user must enter a date before they can click the subform. I can now run the delete query based on there being no date.

    This isn't fool proof. But it does help.

    It's possible someone opens the form to enter data, whilst someone else triggers the delete query (deleting the current record). Ill have a think about it but this is an improvement.

    Thank you.

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    This "new record" must not be created by using default values, otherwise there would be nothing to save. You must be populating the form fields directly based on form load code or something. That's the root of your problem.
    If you can't eliminate the application close button, I see no way around not using default values except for requiring at least x fields to be not null upon form unload, and if they are, delete the record. Or you could set a flag if the form close button is used, thus if the db close is invoked, the flag is false, thus delete the record. To me, any of this seems like a hack when you could used default values - either in the table design or by setting the property on form load.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Thank you for your input. Interesting ideas.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. unwanted field changes
    By Bucs in forum Access
    Replies: 3
    Last Post: 11-27-2019, 01:19 PM
  2. Replies: 15
    Last Post: 02-01-2018, 05:04 PM
  3. Subforms and unwanted duplicate records
    By Del Coro in forum Forms
    Replies: 5
    Last Post: 02-24-2011, 03:16 PM
  4. protecting records from unwanted edits
    By Hunt2871 in forum Security
    Replies: 2
    Last Post: 08-01-2010, 10:49 PM
  5. Unwanted Dialog Box
    By ntallman in forum Programming
    Replies: 3
    Last Post: 03-26-2010, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums