adding buttons for specific records in the database. RRS feed

  • Question

  •  Hi ,

    i Currently have a database in which Store records. What i would like to do is to add a command button or  a hyperlink to the same row to a specific record in the database. i currently use a subform to display the items in the table in the form.

    Essentially, the end expected output will be as shown,

    Thanks is advance!

    • Edited by syahid noor Tuesday, June 12, 2018 12:48 AM
    Tuesday, June 12, 2018 12:47 AM

All replies

  • Hi,

    I don't think you will be able to do it with a command button but might be able to use a Textbox made to look like a command button in conjunction with Conditional Formatting to "hide" the other buttons you don't want displayed.

    Just my 2 cents...

    Tuesday, June 12, 2018 1:59 AM
  • I don’t see why you can’t just place the button in the detail of the continues form?

    When you do this, the button “repeats” for each row.

    So in this access form, the button “Edit Room” on the right side repeats for each row. I only placed the button "one time" on the form - as long as if you place it on the continuous form "detail" section, then it will repeat automatic for each row.

    And in this example, I place “one” button on the left side. You can “click” on the button to edit launch a detail form that edits the one record:

    Note that you can reference “any” value in your VBA such as “” to get the value of any column or control from that current row.

    I am not sure why you screen show shows only “one” button – but the button should “repeat” automatic for you for each row. The amazing part is Access will repeat all controls for you - including buttons you place along side any text box etc.


    So in the last form, the code behind the button to "jump" and launch a details form to edit the one record looks like:

    docmd.OpenForm "frmDetails",,,"id = " & me!id


    Albert D. Kallal (Access MVP, 2003-2017)

    Edmonton, Alberta Canada

    Wednesday, June 13, 2018 9:46 PM
  • Hi syahid,
    We assume that you mean that you want to see a button for each record. That is the usual method. However, in your example you show that you only want to show one button. Is that really your intention?
    Wednesday, June 13, 2018 10:59 PM
  • Hi Peter, 

    Yes, i only intend to show one button, not for every record.


    Thursday, June 21, 2018 12:56 AM
  • Hi syahid,

    I would not know any other method than the method Albert has explained to you. A button should be displayed with each record so that an action with the button can refer to that record. This is the most logical. Exactly in the same way that a field is also displayed with each record.

    If you do not want that, you will have to create a single form that only shows one record at a time. Then there is only one button per record.

    If you still want a continuous form, you can also call a function via the ribbon, but in that case the desired record must have the focus. This is - I think - a less logical method because the user first has to designate the correct record and then you have to check it. Why would it be a problem when you see a button with every record?

    Users often have wishes, but often do not know what is going on behind the scenes. They often want to make decisions without expert knowledge. People often do not know their place.

    Thursday, June 21, 2018 11:48 PM