Results 1 to 6 of 6
  1. #1
    JMac is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    21

    Command button on Form to copy text box data to table field

    Hi all
    I have a need to place some generated data that resides in a text box on a form into a field in a table using a command button. The code is obviously wrong here but I was starting with the following..

    Private Sub Command_Click()
    Me!Textbox = ?? TableFieldname
    End sub

    What do I need to replace the ?? with? or am I way off target?


    Cheers
    Jon

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The button would need to run an Update query.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,524
    Alternatively, open a recordset and use the AddNew or Edit methods as appropriate.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    JMac is offline Novice
    Windows XP Access 2003
    Join Date
    Feb 2012
    Posts
    21
    Quote Originally Posted by aytee111 View Post
    The button would need to run an Update query.
    I went with this method mainly as Id not worked with record sets before. It worked beautifully right up until I added the final crucial expression to the 'update to', ie the record number, and it came back with the error 'type coversion failure'
    As this incremental number is critical how can i get around this??
    Cheers

  5. #5
    raton is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2012
    Posts
    22
    1. generated data that resides in a text box on a form.
    2. make a textbox in the form, which control source is table field. data default value, forms!formname!generated textbox name
    3. generated textbox lostfocus event
    private_sub generated textbox lostfous
    textboxname(which control source is the field name) = generated textbox name
    end sub
    4. invisible the table field textbox

  6. #6
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Post your SQL/code

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

Similar Threads

  1. Replies: 3
    Last Post: 10-17-2011, 01:13 PM
  2. Command button to input data in a table
    By wilsgaard in forum Forms
    Replies: 1
    Last Post: 08-07-2011, 07:59 PM
  3. Replies: 11
    Last Post: 06-02-2011, 10:21 AM
  4. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  5. copy data from text file into table in access
    By miziri in forum Programming
    Replies: 3
    Last Post: 08-12-2009, 03:02 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