Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2010
    Posts
    4

    Having trouble with moving text to table

    I am trying to store the name of a table in another table to be able to access it later with a combo box. I am storing it in "TableNames" in the column "Table Name". I am trying to store values from an unbound text box "tablename" on the form "MainForm"



    This is the code i am using

    CurrentDb.Execute "INSERT INTO TableNames (Table Name) Values(" & MainForm.tablename & ")"

    Any help is appreciated
    Thanks
    Last edited by geoffwbailey; 06-17-2010 at 09:38 AM.

  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,640
    If it's a text value, it needs to be surrounded by single quotes (just inside each of the parentheses). Also, I think the form reference is off:

    Forms Refer to Form and Subform properties and controls

    If there is really a space in your field name, it would need to be bracketed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jun 2010
    Posts
    4

    it worked

    That worked. Thanks a lot

  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,640
    No problemo; welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

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