Results 1 to 8 of 8

Thread: [RESOLVED] How to handle events of subform cells at runtime in Access

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    9

    Resolved [RESOLVED] How to handle events of subform cells at runtime in Access

    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:

    Name:  _1.jpg
Views: 234
Size:  36.7 KB

    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?
    Last edited by Technical; May 18th, 2022 at 05:12 AM.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: How to handle events of subform cells at runtime in Access

    First... Is this a VB.Net question??? Is this an Access VBA question???
    The two aren't interchangeable - they're different technologies, and the answer to your question depends on the answer to those questions.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to handle events of subform cells at runtime in Access

    .paul. is right to ask that question but, based on the name "dgvRecipesList", I'm going to go out on a limb and guess that what you're calling a "subform" isn't (because there's no such thing in WinForms) and it's just a DataGridView control. If what you're saying is that you want only certain columns in a DataGridView to be editable then set the ReadOnly property of those columns to False and all others to True. It's just a property like any other so you can set it in the designer (if your columns are created there) or at run time.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    9

    Re: How to handle events of subform cells at runtime in Access

    I'm sorry... I don't know what happened. I could've sworn I created the thread under the Visual Basic 6 and Earlier category.
    Any chance the thread can be moved under that category?
    My issue is related to access controls, so it's specific to a subform with the name dgvRecipesList. I gave it that name, because it's similar to a datagridview on vb.net.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: How to handle events of subform cells at runtime in Access

    You can click the Report Post icon under your own post to send a message to the mods and ask for it to be moved. The question where to move it to. Is this a VB6 question or a VBA question?

  6. #6

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    9

    Re: How to handle events of subform cells at runtime in Access

    Quote Originally Posted by jmcilhinney View Post
    You can click the Report Post icon under your own post to send a message to the mods and ask for it to be moved. The question where to move it to. Is this a VB6 question or a VBA question?
    It's a VBA question.
    I just reported the post.
    Also, I just found out the solution to the problem and will post it as soon as the thread is moved.
    Last edited by Technical; May 19th, 2022 at 05:29 AM.

  7. #7
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: How to handle events of subform cells at runtime in Access

    Moderator Actions: Moved to Office Development which is for all questions regarding Microsoft Office Automation. This can include VSTO, VSTA, and VBA questions.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  8. #8

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    9

    Re: How to handle events of subform cells at runtime in Access

    I found out that the problem was all about the way I created the subform.
    When I created the subform I linked it directly to the tbReceitas table without any kind of design "behind it" and tables don't have events.
    So, all I did was delete the subform I had a created a new one that would link to fields and from there I can have access to the fields events and properties.

    Thanks for the time everyone.

    Also, thanks dday9 for moving the thread to its proper place.

Posting Permissions

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



Click Here to Expand Forum to Full Width