Error inserting filepath into record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • damicomj
    New Member
    • Sep 2010
    • 34

    Error inserting filepath into record

    Run-time error '3075':

    Syntax error (missing operator) in query expression 'C:\Documents and Settings\etc.pd f'.


    I believe I am getting this error because of the space in the file path, but I am not sure. Here is the code:

    Code:
    strTable = "tblSLA"
    strColumns = "(LeaseID, SLAAttachment)"
    strValues = "(" & Me.LeaseID & ", " & strFile & ")"
    
    strSQL = "INSERT INTO " & strTable & " " & strColumns & " VALUES " & strValues & ";"
    
    DoCmd.RunSQL strSQL
  • Mariostg
    Contributor
    • Sep 2010
    • 332

    #2
    Because you insert a string, you are missing single quotes around your file path. It is not appearant here but try:
    Code:
    strValues = "(" & "Me.LeaseID" & ", '" & strFile & "')"

    Comment

    Working...