Results 1 to 2 of 2
  1. #1
    Nikh is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2016
    Posts
    19

    How to Insert Form Data into Access Table using vba code

    Hi...


    I am New to MS Access and I am Using Access 2013 64 bits...I want to insert userform data into access table using vba code i.e select into table and value...

    But the data to insert into table is huge....i.e data field is alomost 56 textbox and i am unable to use all textbox value into vba due to line character limit.

    How should i do this...

    for example...when i post below code into vbe it shiwing red line



    CurrentDb.Execute "Insert Into Group(& b1 & b2 & b3 & b4 &) " & _

    " values( """ & Me.branchcbo & """,""" & Me.txtsfoname & """,""" & Me.txtsfoempid & """,""" & Me.txtlafno & """,""" & Me.txtrelationshipname & """,""" & Me.txtmobile & """,""" & Me.txtvoter & """,""" & Me.txtage & """,""" & Me.txtdob & """,""" & Me.txtaadhar & """,""" & Me.txtrationcard & """,""" & Me.txtlightbill & """,""" & Me.txtaadress & """,""" & Me.txtpincode & """,""" & Me.txtclientname & """,""" & Me.Combo398 & """,""" & Me.cborelationship & """,""" & Me.txtkendraid & """,""" & Me.txtcbid & """,""" & Me.txtcbstatus & """,""" & Me.txtnomineename & """,""" & Me.txtvillage & """,""" & Me.txtcbdate & """,""" & Me.txtsuprtnoczhapp & """,""" & Me.txtloanacno & """,""" & Me.txtdvufile & """,""" & Me.txtvillagecode & """,""" & Me.txtnomineeage & """,""" & Me.txtnomineedob & """,""" & Me.txtrelationshipnominee & """,""" & Me.cboinsurancetype & """,""" & Me.txtnamebankpassbook & """,""" & Me.txtifsccode & """,""" & Me.txtaccountno & """,""" & Me.txtbranchname & """,""" & Me.cboloanamount & """,""" & Me.cboloancycle & """,""" & Me.txtpdtname & """,""" & Me.txtgropuordate & """,""" & Me.txtgroupfordate & """,""" & Me.txtfinancialtradate & """,""" & Me.txtgroupappdate & """,""" & Me.TxtDisbDate & ""","
    """ & Me.cbobankname & """,""" & Me.TxtPdtcode & """,""" & Me.TxtNeftAmount & """,""" & Me.txtState & """,""" & Me.Txtcluster & """")"

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Is there a reason you don't bind the form to the table and let Access do all the work for you? You can add line continuation characters, though your fields don't appear to match up. If you want to go this way, these should help:

    http://www.baldyweb.com/BuildSQL.htm

    http://www.baldyweb.com/ImmediateWindow.htm
    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: 6
    Last Post: 07-01-2015, 10:56 AM
  2. Replies: 7
    Last Post: 04-05-2015, 02:31 PM
  3. insert data into oracle linktable from access table
    By newaccess in forum Import/Export Data
    Replies: 1
    Last Post: 01-04-2013, 02:20 PM
  4. Replies: 3
    Last Post: 09-13-2011, 07:58 PM
  5. Replies: 2
    Last Post: 12-22-2010, 01:46 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