Results 1 to 9 of 9
  1. #1
    NickWren is offline Advanced Beginner
    Windows XP Access 2013
    Join Date
    Dec 2015
    Location
    Connecticut
    Posts
    70

    Adding a record will add a command button

    I am almost 100% sure that this is not possible; but I want to try to make this work.
    I have a client that wants a button made on frmFacilityMain each time a new recorded is entered into a certain frmFacilityEntry;
    The button should have the name associated with a field on the table called "FacilityName"

    FacilityName: New York

    Command#: [New York]



    Opens form with New York information filled out from frmFacilityEntry.

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    So every time a new record is entered, you want to add a new button on a form?

    Easy

    But won't you run out of room


    Sent from my iPhone using Tapatalk

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    in form design, you can add the button on the record detail band.
    the code for the button will open a form to view only that record.

    docmd.openForm "myForm",,,"[id]=" & txtID

  4. #4
    NickWren is offline Advanced Beginner
    Windows XP Access 2013
    Join Date
    Dec 2015
    Location
    Connecticut
    Posts
    70
    The room on the form was my only other concern; it will be a pretty empty form; but I dont know how to tell it to move the bottom over a column or even down a row, when there is already a button in that area

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    the button is on the record. Every record will get a button.

  6. #6
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Me thinks Nick is saying he wants this to happen automatically - not having to manually add the button in Design View. Although it may be possible, real estate would be an issue. Something I'd never want to have to deal with. I would rather create a list box with the values and open the form with it as the criteria when either the item in the list is double-clicked or a command button is clicked.

  7. #7
    NickWren is offline Advanced Beginner
    Windows XP Access 2013
    Join Date
    Dec 2015
    Location
    Connecticut
    Posts
    70
    Yeah; I could easily do a list box or a subform (drag in the table) and whatever value is highlighted have that forms values pop-up (Which is what I am doing now, but my client is very old school and wants a button that clearly states what facility it is associated with). But there are several different options I can go with so. I could use some help on another problem; and I will just tell the client that the other two options are more reasonable for versatility.

    https://www.accessforums.net/showthread.php?t=65313

  8. #8
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Nick how many records can we expect. It's "simple" enough to appear to add a button when a new record is added.

    Just create in design view a screen of say 50 buttons

    When the form opens you can run through each one naming it and making the rest invisible.

    If you link the on_click event to the button name you can use an identical line of code for each button.


    Sent from my iPhone using Tapatalk

  9. #9
    swas is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Apr 2017
    Posts
    32
    If the button is to be in the detail section, as per ranman every record will get the button.

    You can get past this by using a text box colored up to look like a command button, responding to the onfocus event or similar so it emulates a command button.

    This way you can use the textbox conditional formatting to show / not show the "button" based on me.NewRecord or other criteria.

    Alternatively, put a command button in the header section, and in the form current event check if it is a new record, making the command button visible / enabled or whatever you need for the selected detail record.

    swas

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

Similar Threads

  1. Replies: 2
    Last Post: 09-05-2016, 07:23 AM
  2. Replies: 7
    Last Post: 05-13-2014, 10:07 AM
  3. Replies: 4
    Last Post: 07-22-2011, 12:52 PM
  4. Adding Pop-ups via Command Button
    By jlclark4 in forum Forms
    Replies: 1
    Last Post: 01-05-2011, 02:41 PM
  5. Adding Command Button To Form
    By uneek78 in forum Forms
    Replies: 7
    Last Post: 03-27-2009, 07:43 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