Results 1 to 7 of 7
  1. #1
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35

    Handling Subform Cell Events at Runtime

    Hello there,
    I was asked to create user input interfaces for an Access database and now I'm stuck on how to handle subform events specifically for cells.
    I have a subform named dgvRecipesList (marked with a red square) that is based on data gathered from a table named tbReceita:

    Click image for larger version. 

Name:	_1.png 
Views:	11 
Size:	18.8 KB 
ID:	47828



    The subform, at the form's load event has the property AllowEdits disabled.
    What I'm trying to achieve is, the user must only be able to edit cell values from the column identified as QT.
    The button below the subform, with the text Editar, will only be enabled when the user selects any cell from the column QT.
    Then, when the user clicks the button with the text Editar, the subform's AllowEdits property will be enabled and the text of the button will change to Guardar (which means save).
    After this, the user can change the desired cells' value and when done clicks the button that now has the text Guardar, saving the new values into the table, disabling the subform's AllowEdits property and, finally, reverting the button text to Guardar.


    The problem I have at hand is that I have no way of handling events for the subforms cells, at least not directly from the designer, so how can I achieve this?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Why not just set the Enabled property to false and the locked property to true for all the fields except the QT one.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    The subform itself has events, but I don't think you need them.

    In the subform design view select the controls for all the fields except QT and in the data tab in properties change the property named Locked = Yes
    This will allow edits only for the QT field, no need to switch them in and out.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    I'm not able to see any controls within the subform on design view. There's just a blank square with the link to the data table:
    Click image for larger version. 

Name:	_1.png 
Views:	6 
Size:	66.7 KB 
ID:	47844
    So how am I suppose to do what you're suggesting?

  5. #5
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    That's because you have inserted a Table directly.

    Create a proper subform for the table data, then you will see fields and controls appear.
    A table doesn't have controls.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    Simbiose is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2015
    Posts
    35
    Yeah, I just realized that it was all about how I created the subform *sighs*...
    Thanks for the help and sorry for wasting time guys.

  7. #7
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    No problem, Access lets you do lots of things that in the real world, more experienced developers wouldn't do.
    You have stumbled across one of them.

    Good luck with the rest of your project.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Trigger subform events
    By Radwar in forum Forms
    Replies: 4
    Last Post: 09-29-2018, 12:01 PM
  2. Replies: 2
    Last Post: 01-18-2017, 09:11 AM
  3. Subform events do not seem to be firing
    By mantooth29 in forum Programming
    Replies: 2
    Last Post: 12-12-2013, 03:13 PM
  4. Adding events at runtime
    By bonecone in forum Programming
    Replies: 2
    Last Post: 04-13-2012, 02:18 AM
  5. Can't Find Subform Events
    By vdanelia in forum Forms
    Replies: 4
    Last Post: 02-28-2011, 02:23 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