Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2007
    Posts
    148

    Unanswered: Subform causing record to save

    I have a very weird problem and hope someone can help me.

    I have a main form (frmChangeOfControlForm) and it contains a tab control. Inside the tab control I have 2 pages. The first page has two subforms (one base on a table and one base on query). I don't have anything in the second page yet.

    Everything works fine except when I edit other controls in the main form and accidentially "CLICK" in these subform area, Access will do a save on the record. I really don't want this to happen especally when I am adding new record as I may not want to save the record at all.

    All in all, I want to save any updated record and new record when I actually hit the save button in the main form.


    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    That is normal behavior for a bound form/subform. What do you want to happen if the user clicks in the subform?
    Paul

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Nothing I would assume.

    Just unbind the forms.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Sep 2007
    Posts
    148
    My main form and subform are related by the main form primary number. If I unbind the forms would my subform doesn't know which records to display?

    Thanks

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes. Sorry, I was being a bit vague there. To clarify:

    Unbind the fields on the main form, with the exception of the key field. By doing that, the mainform's content (which the user might modify) is disconnected from the underlying recordset and therefore won't be effected by stray clicks that may force a save. Only your save button will do the saving.

    But... the bigger question is "Is it worth it?". Why not just allow the save? If you later decide you don't want to allow the save, just delete the record? It's certainly less work for you.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Sep 2007
    Posts
    148
    Thank you StarTrekker,

    I really need to think about your suggestion carefully. This particulare form was intended not to allow any deletion. This is part of the Business Continuity solution for the company. We don't want user to be able to delete the form. May be I need to convince them to allow the deletion. Maybe completely lock down those approved forms.

    thanks again for your help as always.
    Thanks

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Not necessarily. You can disallow users the ability to delete records with a form and in that same form, code can be written to delete records. So you can have a form where users cannot delete records with and if your logic should determine that the record should never have been entered (after a save) then you could automatically delete the record.

    However, it is also true that you should carefully consider allowing users to delete records (at least some of them) otherwise mistaken entries can clutter up your data - destroying the integrity of reports until a manager deletes mistaken data (if it's ever reported).

    And you're welcome btw
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    Sep 2007
    Posts
    148
    Thanks for your reply, StarTrekker. I am still working out the solution on it. Your last solution seems to be a good one.

  9. #9
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Good luck with it
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •