Results 1 to 11 of 11
  1. #1
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20

    Command Buttons on form

    How to create a command button on a form that designates which button was clicked in the table that the entry is made?



    Background - We orignally had 9 spreadsheets, I combined all the spreadsheets into one table, because all the fields are the same, we will still have 9 people inputting data from different departments.

    Date Started
    Date Ended
    Activity
    Detail
    Author
    Title
    Subject
    Charged to (text field)
    Comments (memo field)

    I want to add another field (User1) if User1 button is clicked or (user2 if another button). I need to be able to allow them to run a query based on the entries that each indivdual entered that week so they can add/change entries as needed but only for their own input.
    Any help would be appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I'd have a single user field, and a combo box on your form to select the user. Then you can use something like this to restrict forms and reports.

    http://www.baldyweb.com/wherecondition.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20
    But how do I mark the records according to which user added a new record to the database so they will see only their records not another persons?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You would have to be populating that user field during data entry. I don't know how you would know after the fact (how were you going to use a button?). You can use the Environ() function or this type of function to get the user, if you don't have them logging in:

    http://access.mvps.org/access/api/api0008.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20
    Will this put that person's name in a field on the database, then that could be used to query the database weekly?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    They are tools that can be used to do that, yes. Setting the default value of a textbox to one of them would be one way to use them.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20
    What tools would I use to do that?

  8. #8
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20
    Yes putting it in the textbox as default work. Thanks much Pbaldy.

    One more question can you put a password on a command button? In other words when they click on it before it shows the form it requires a password. Is this possible?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Sure, but you have to code it yourself. You can either use an InputBox to have the user enter their password or this, which is what I use:

    http://www.baldyweb.com/WrappedForm.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    bespra is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2010
    Posts
    20
    Thanks for you help works great

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Command Buttons
    By BLD21 in forum Access
    Replies: 2
    Last Post: 05-10-2011, 06:27 AM
  2. Command Buttons
    By Rosier75 in forum Access
    Replies: 3
    Last Post: 03-09-2011, 11:59 AM
  3. command buttons
    By nashr1928 in forum Forms
    Replies: 23
    Last Post: 10-15-2010, 04:09 PM
  4. Command buttons
    By maintt in forum Forms
    Replies: 3
    Last Post: 08-03-2010, 09:52 AM
  5. Replies: 2
    Last Post: 04-11-2006, 08:40 AM

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