February 21, 2006 at 7:38 am
INSERT INTO Name(Surname, FirstName) FROM SELECT Surname, Name
From OtherNames WHERE Age < 30;
Hi,
Just new for this kind of programming. I am using VB for the code below. I have a recordset (rs) that I want to insert in TestCorpFile where I dont want to insert rs!EXP_CTrY = 'vn'. I tried to follow the syntax I researched in the above of my message but I didn't get it right. Please need someones expertise. Thanks in advance.
rs.Open "Pacrim", cnCurrent, adOpenDynamic, adLockOptimistic, adCmdTable
cnCurrent.Execute ("insert into TestCorpFile(Ctry_code,Ship_ID,LCamount,USDamount,Weekending)" & _
" values ('" & rs!EXP_CTrY & "','" & rs!SHIPMENT_ID & "'," & rs!CONVERTED_AMOUNT & "," & rs!USD_AMOUNT & ",'" & rs!TDATE & "')")
February 21, 2006 at 8:50 am
When you create a SQL statement like this in VB it becomes (as you've noticed) very difficult to work out whether it's correct. I suggest you do something like the following
dim strSQL as string
strSQL = "insert into TestCorpFile(Ctry_code,Ship_ID,LCamount,USDamount,Weekending)" & _
" values ('" & rs!EXP_CTrY & "','" & rs!SHIPMENT_ID & "'," & rs!CONVERTED_AMOUNT & "," & rs!USD_AMOUNT & ",'" & rs!TDATE & "')"
msgbox strSQL
and you'll be able to work out what's going on. Then just
cnCurrent.Execute(strSQL)
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy