Results 1 to 12 of 12
  1. #1
    Jokimom is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    3

    Command Button to input specific text into a table field

    On a simple form: I'd like to build an expression that when a command button is clicked that a pre-defined value (text or #) would populate in the approp. field in the underlaying record source table when the record is complete.



    Thank You

  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,521
    In the click event of the button:

    Me.BoundTextboxName = "Your text here"

    or

    Me.BoundTextboxName = 12345
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jokimom is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    3

    Command Button

    I did this previously but nowe can't figure out how to link the command button to the specific field in the table where the "text" will be placed.

    The form is set up with the table as the record source, but in the properties for the command button on the data tab I am not given the option to enter control source.

  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,521
    The "BoundTextboxName" in my example was meant to refer to a textbox on your form that was bound to the target field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Jokimom is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    3

    Command Button

    I got it. Thank You ! I have seen the light instead of asking the command button to enter data directly into the underlying table, I am having it enter the data into a a bound text box on the form (which is not visible to the User). Thank you for the VBA script.

  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,521
    No problem. You could go directly to the table, but since the form is bound to the table it's much easier to do it through the form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    crabbymcdo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    4

    Please Help

    Hi Guys
    not worked on Access UI for a long time and im now currently working on a new file,

    i need to be able to populate a table cell from the click of a command button, i tried the above answer but i guess im missing something

    Please help

    thanks

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Part of what you're missing is an example of what you tried and a description what went wrong.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    crabbymcdo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    4
    what i tried was
    Me.txtvisiting = "Staff Name"
    i also tried
    frmdetailsin.txtvisiting="staff name"

    the error i get was a Run Time Error '424' Object required
    with the entire sentence highlighted on the debug

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The second isn't valid syntax, but I would expect the first to work. Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    crabbymcdo is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    4
    the DB is 16mb so to big to send

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you export this form and whatever it needs to run into a new db? That is the correct name of the textbox, right?
    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. Replies: 1
    Last Post: 09-13-2010, 01:57 PM
  2. Command button to change value of other field
    By teirrah1995 in forum Programming
    Replies: 8
    Last Post: 09-09-2010, 10:23 AM
  3. Changing Field Values with Command Button
    By avarusbrightfyre in forum Access
    Replies: 1
    Last Post: 08-22-2010, 12:48 PM
  4. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  5. Updating another record table with command button
    By erlan501 in forum Programming
    Replies: 5
    Last Post: 04-26-2010, 09:03 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