Jim DeMarco
Jdemarco at hshhp.org
Thu Nov 13 09:19:11 CST 2003
Sure just change to read:
strSQL2 = "INSERT into Neww(a,b,c) Values (" & strLine & ", " & rs(1) & ", " & rs(2)& ")"
HTH
Jim DeMarco
-----Original Message-----
From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com]
Sent: Thursday, November 13, 2003 10:15 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] inserting in DAO
hey group
Can I use string name in insert function ?
strSQL2 = "INSERT into Neww(a,b,c) Values (strLine,rs(1),rs(2))"
it gives me an error message
...
Private Sub Command0_Click()
MsgBox ("hey")
Dim strLine As String
Dim strSQL1 As String
Dim strSQL2 As String
Dim db As DAO.Database
Dim i As Integer
Dim rs As DAO.Recordset
Set db = CurrentDb
strSQL1 = "Select * From New"
Set rs = db.OpenRecordset(strSQL1)
Do Until rs.EOF
strLine = rs("FullName")
MsgBox strLine
i = InStr(strLine, " ")
If i <> 0 Then
strLine = Left(strLine, i)
End If
rs(0) = strLine
' strSQL2 = "INSERT into Neww(a,b,c) Values (strLine,rs(1),rs(2))"
strSQL2 = "INSERT into Neww(a,b,c) Values (rs(0),rs(1),rs(2))"
Debug.Print strSQL2
CurrentDb.Execute (strSQL2)
rs.MoveNext
Loop
MsgBox ("end")
End Sub
-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
***********************************************************************************
"This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You".
***********************************************************************************