Copy and add the data into the table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmadbaseet
    New Member
    • Aug 2007
    • 15

    Copy and add the data into the table

    Hello, I have problem. I want to copy the data from the table and add it to another table. This is simple, But the problem is that the I want to copy as well as add the data from variables into table. i.e.
    strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "

    In SubProj, I want to add in Project field not from the other table but from the variable called pNumber. Can somebody help me.. Thanks in advance
  • ahmadbaseet
    New Member
    • Aug 2007
    • 15

    #2
    please help me. it is urgent

    Comment

    • kjworm
      New Member
      • Nov 2006
      • 26

      #3
      Originally posted by ahmadbaseet
      Hello, I have problem. I want to copy the data from the table and add it to another table. This is simple, But the problem is that the I want to copy as well as add the data from variables into table. i.e.
      strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "

      In SubProj, I want to add in Project field not from the other table but from the variable called pNumber. Can somebody help me.. Thanks in advance
      Try:

      Code:
      strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT "& pNumber &" , SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "
      This is for if your pNumber is calculated in the code
      or
      Code:
      strSQL2 = "INSERT INTO SubProj (Project, SubProject, Stundensatz ) SELECT "& [pNumber] &" , SubProjectName, Kosten FROM Mustertabelle WHERE Check = -1 "
      This is for if you pNumber is on your form or whatever.

      Comment

      Working...