Results 1 to 3 of 3
  1. #1
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26

    Need to add a space in an insert query

    I cannot seem to get the syntax correct to add a space between "HMDA disposition changed:" and & Disposition().

    Help please...



    Code:
    DoCmd.RunSQL "INSERT INTO tblCommLog ( FileNumber, Date_Time, Comm_Subject, User, Content )" & _
    "SELECT [Forms]![frmProcessingQueue]![FileNumber] AS Value1, Now() AS Value2, 'Record Edited' AS Value3, fOSUsername() AS Value4, 'HMDA disposition changed:' & Disposition() AS Value5;"

  2. #2
    jax1000rr is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    26
    Figured it out...

    DoCmd.RunSQL "INSERT INTO tblCommLog ( FileNumber, Date_Time, Comm_Subject, User, Content )" & _
    "SELECT [Forms]![frmProcessingQueue]![FileNumber] AS Value1, Now() AS Value2, 'Record Edited' AS Value3, fOSUsername() AS Value4, 'HMDA disposition changed:' & SPACE(1) & Disposition() AS Value5;"

  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,525
    You can simply add a space to the preceding string:


    'HMDA disposition changed: ' & Disposition() AS Value5

    or

    'HMDA disposition changed:' & " " & Disposition() AS Value5

    but the first is the most efficient.
    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. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  2. Replies: 6
    Last Post: 02-20-2013, 12:32 AM
  3. Insert query with a variable
    By Newby in forum Access
    Replies: 1
    Last Post: 12-31-2012, 09:09 AM
  4. INSERT with SELECT query.
    By goodguy in forum Queries
    Replies: 8
    Last Post: 09-23-2011, 10:38 AM
  5. INSERT INTO query in VBA
    By jgelpi16 in forum Programming
    Replies: 5
    Last Post: 09-17-2010, 02:19 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