Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43

    Change table with checkboxes, perform actions (send e-mail, delect line, see details of deleted row)

    Hi guys, I’m a beginner in VBA.

    In the Example.zip file I have a table “tblqryCountPerSore”. This table is created by the “qryCountPerStore Maketable”.


    The table “tblqryCountPerSore” shows the number of products (A, B and C) per customer and storenumber.

    Now. There a a number of reasons to delete a store from the “tblqryCountPerSore”-table (closed, no products, not efficient, not reachable, etc.). This can only be done by human interaction.

    What I want to do in “tblqryCountPerSore”:
    -For the shops that won't be delivered I want to be able to delete them from the table so I have a clean list of what will be deliverd.
    -I want to be able to send an e-mail to the shop that are deleted so the won’t expect any products. Als for the shops that have no products.
    -Somehow it must be clear witch product (from tblMutations) are not delivered.

    E-mailadresses are stored in tblStores. I necessary (for simplicity) I can put them in the “tblqryCountPerSore”.

    Can someone put me in the right direction? Maybe there is a way to use checkboxes in the "tblqryCountPerSore”.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Recommend not deleting, just flagging as 'Inactive'. Then apply filter criteria to exclude 'Inactive' records.

    If you delete the store, are there related dependent records to also delete?

    Why are you using MakeTable query?

    Don't work directly with tables and queries, uses forms and reports.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Hi June7. Thanks for the information.

    If I delete the store from the tblqryCountPerSore-table, there are no dependent records to delete.
    When someone makes a mistake in the corrections, the table can be created again.
    Therefor i use a Maketable query.

    How can I implement the inactive flag?
    What are the diffrence by using a form or report?
    I don't think the 3 points I want tot implement can be implemented by a report.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Right, use form for input and report for output - users should not work directly with tables and queries.

    I still don't understand why you would use MakeTable - if the data is deleted, where would you retrieve it from to restore? Routinely programmatically modifying db structure is not advised.

    The inactive flag would just be a field - a yes/no or a data/time or a text. This way if relationship with store is renewed, just change the value in field. This is safer than deleting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Thanks June7!

    I want this to be a MakeTable so I can change things. If something goed wrong, I can use the MakeTable again.
    I çan't mess with the original data this way.

    I am going to test with the field.

  6. #6
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Quote Originally Posted by June7 View Post
    The inactive flag would just be a field - a yes/no or a data/time or a text. This way if relationship with store is renewed, just change the value in field. This is safer than deleting.
    Hi June7.

    I tried to make a yes/no field (with yes a default value), but I can get it to the “tblqryCountPerSore” by using “qryCountPerStore Maketable".
    It should be simple. I tried to make a field yes/no in “tblqryCountPerSore”, but this will be overwritten by “qryCountPerStore Maketable".
    Als I tried to put it in the tblMutations, but this is not seems to work with the crosstable query.

    Any advise? Maybe you can show it in the example-file?

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    If you're still seeking a solution you could try adding a yes/no field to the "tblStores" table. Then add tblStores to the query "qryCountPerStore MakeTable" and join with the "Storenr" field so the flag field can be added to the query and used to set criteria.

    See file attached
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Thought I had responded with the same recommendation to add y/n field to tblStores. Where did you attempt to add and why if not tblStores?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,535
    Quote Originally Posted by June7 View Post
    Thought I had responded with the same recommendation to add y/n field to tblStores. Where did you attempt to add and why if not tblStores?
    Yes June7, I believe you did recommend the use of a y/n field in the table "tblStores". However, judging by the comments made by the OP in post #6 the OP was still looking for more advice. Also, the OP had asked me to take a look at this thread. Please accept my sincere apologies if I have caused any offense.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    No apologies needed by you. I was just trying to convey I had intended to reply to OP's last post and thought I had. My earlier posts did not explicitly say to add field to tblStores but then would not have thought needed to.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Quote Originally Posted by Bob Fitz View Post
    If you're still seeking a solution you could try adding a yes/no field to the "tblStores" table. Then add tblStores to the query "qryCountPerStore MakeTable" and join with the "Storenr" field so the flag field can be added to the query and used to set criteria.

    See file attached
    This example is very helpfull! Thanks guys! I'm sorry that I didn't understood you previously June7.

    One thing doesn't seems to work right. After putting in the flag at the tblStore and making a new query that combine the cross table query and the flag field I get the tblqryCountPerStore with the flag. But the flag is a -1 (for yes) or a 0 (for no). Is there a way to make this alsso a checkbox?

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Checkbox is a control on a form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Quote Originally Posted by June7 View Post
    Checkbox is a control on a form.
    sorry for this newbe question. Thanks!

    One last question: for the make table query there must be at least 1 product for A, B and C. Somethimes there no product A, B or C. Is there some way to workaround this?

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    I don't understand the question. If there must be a product then why would there not be one?

    I still don't understand the need for make table query.

    Also, correction to earlier statement. It is possible to set yes/no field to display a checkbox in table design and it will carry over into query. In table design set focus on the field and make sure checkbox is set as DisplayControl on the Lookup tab.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    dennisb82 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Aug 2017
    Posts
    43
    Sometimes it happens that (for example) product C is not in stock. If thats the case, the make-table can't be created beacause it wants to have a minimum of 1 product A, 1 product B and 1 product C. So how can I create the table if one of the products is missing?

    The make table is there to let a human make changes on the table that can't be done by algorithms. Also the original data is still available when something goed wrong. This also is the case when I use a form on this table.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 12-18-2013, 02:49 PM
  2. Using checkboxes to perform a search
    By zcrox69 in forum Forms
    Replies: 1
    Last Post: 05-16-2013, 01:18 PM
  3. Send automatic e-mail
    By Csalge in forum Forms
    Replies: 1
    Last Post: 04-08-2013, 11:33 AM
  4. Replies: 1
    Last Post: 09-14-2012, 10:27 AM
  5. Replies: 0
    Last Post: 11-23-2009, 09:19 PM

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