Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2016
    Posts
    6

    Data Entry Form with 2 Subforms (continuous style) - "Cancel and Exit" Button Help

    So I have a one big Data Entry Form. Within it, are two subforms that also data entry and continuous. For example. A Customer(form) can add one or more credits(subform). Now usually when you exit a data entry, I use the delete record button and name it cancel and exit, so that the user can choose to leave the form. However, when using subforms that are continuous... say a you enter the customer, and you enter the two credit cards.. If you choose the form 'cancel and exit', only the customer and one of the credit cards deletes, the second credit card remains. I am trying to 'cancel and exit' and delete all record entries associated with that CustomerID created.

    Possible Solutions I was trying:



    1. Convert the Delete Button on the Form to vba and tinker with it... For some reason, access won't let me convert it to a vba
    2. Use VBA - Confused on where to start: should the vba test if the form is filled? does the form automatically add something?


    Please advise.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I assume the "Cancel and Exit" is on the main form, and that you want to delete the customer and the card record(s)?

    There are two ways you could do this. First, you could use VBA in the "Delete" code to delete all the credit card records for the customer before it deletes the actual customer record. The SQL would be something like this:

    "Delete from [CardRecords] where [Customer_ID] = " & me!CustomerID

    The other way would be to define a relationship between [Customers] and [CustomerCards] using Customer_ID, and then turn on the Cascade Update option under Enforce Referential Integrity. Access will then look after deleting the card records automatically.

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

Similar Threads

  1. Replies: 8
    Last Post: 07-15-2014, 05:56 PM
  2. Suppress "Error" message following "Cancel = True"
    By GraeagleBill in forum Programming
    Replies: 7
    Last Post: 03-23-2014, 05:40 PM
  3. Replies: 7
    Last Post: 11-30-2013, 12:33 PM
  4. Replies: 9
    Last Post: 08-19-2013, 03:00 PM
  5. Cancel an entry and exit form
    By michwh1 in forum Access
    Replies: 3
    Last Post: 03-28-2013, 03:13 PM

Tags for this Thread

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