Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Insert Statement


Message #1 by "Vibha Prajapati" <vprajapati@i...> on Tue, 12 Sep 2000 16:59:36 +0100
Dear Vibha,
   As far as I know you cannot use the INSERT statement together with the
where clause.   You can however, insert records by selecting values from
another record.   For instance, if you want to select values from TABLE2,
you will write the following code:

Dim strInsert

strInsert = "INSERT INTO TABLE (Field1, Field2)"
strInsert = strInsert & "SELECT Field1, Field2 "
strInsert = strInsert & "FROM TABLE2 "
strInsert = strInsert & " WHERE Field1 not = '"
strInsert = strInsert & p_field1 & "'"
		Sincerely,
		Regina
-----Original Message-----
From: Vibha Prajapati [mailto:vprajapati@i...]
Sent: Tuesday, September 12, 2000 12:00 PM
To: professional vb
Subject: [pro_vb] Insert Statement


Can i create INSERT statement with the Where Clause.

What is the Correct syntax to write this statement.

Thank you,

Vibha

Dim strInsert

strInsert = "INSERT INTO TABLE (Field1, Field2)"
strInsert = strInsert & "VALUES"
strInsert = strInsert & ('" & p_field1 & "',"
strInsert = strInsert & ('" & p_field2 & "',"
strInsert = strInsert & " WHERE Field1 not = '"
strInsert = strInsert & p_field1 & "'"



  Return to Index