Results 1 to 2 of 2
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    INSERT sql using VBA multiple fields

    Can someone provide info on how to insert more than one value into a row using VBA?



    say

    date
    time
    name
    surname

    using
    CurrentDb.Execute "INSERT INTO table ([field]) " _ & "VALUES (" & control & ")"

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Here is an Example:



    Dim strSQL As String

    strSQL = "INSERT INTO tblReportLog (lrptdte,lsentto,lsubject,lmessage,lbcc, lrptname,loutputtype ) "
    strSQL = strSQL & "VALUES (#" & Me.rdtesent & "#,'" & Me.EmailTo & "','" & Me.EmailSubject & "','" & Me.EmailMessage & "','" & Me.cbobcc & "','" & Me.txtrptname & Me.txtextension & "','""')"


    CurrentDb.Execute strSQL, dbFailOnError

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

Similar Threads

  1. Replies: 3
    Last Post: 01-13-2014, 11:28 PM
  2. INSERT INTO with date fields
    By tylerg11 in forum Access
    Replies: 1
    Last Post: 09-10-2013, 08:36 AM
  3. Replies: 2
    Last Post: 10-20-2012, 12:38 PM
  4. insert multiple rows in access
    By learning_graccess in forum Queries
    Replies: 1
    Last Post: 03-31-2012, 10:15 AM
  5. INSERT INTO and UPDATE to multiple tables
    By lupis in forum Import/Export Data
    Replies: 6
    Last Post: 05-19-2010, 05:21 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