Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160

    Unanswered: INSERT INTO problems

    Hi there,

    I use the following code to append data to a table. It works fine. However, I would like to input the word 'Systems' into the Category field. Could someone help me with the syntax?The other fields are either a textbox reference (RefID) or field from another table.

    SQLtext = " INSERT INTO tbl_Orders (fkeyID,Item,Part_No,Description,Category,List_Pri ce)" & _
    " VALUES (" & _
    "'" & RefID & "'" & _
    ",'" & Item & "'" & _
    ",'" & Part_No & "'" & _
    ",'" & Description & "'" & _
    ",'" & Systems & "'" & _ ' the text 'System' to go into Category field
    "," & List_Price & _
    ")"

  2. #2
    Join Date
    Oct 2010
    Posts
    51
    Take out the &.

    Code:
    SQLtext = " INSERT INTO tbl_Orders (fkeyID,Item,Part_No,Description,Category,List_Price)" & _
    " VALUES (" & _
    "'" & RefID & "'" & _
    ",'" & Item & "'" & _
    ",'" & Part_No & "'" & _
    ",'" & Description & "'" & _
    ",'System'" & _ 
    "," & List_Price & _
    ")"
    You've written it as if System were a variable to be evaluated. If you want the actual string value "System" then just use it within the string.

  3. #3
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160
    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •