[AccessD] inserting in DAO

paul.hartland at fsmail.net paul.hartland at fsmail.net
Thu Nov 13 09:26:17 CST 2003


Just quickly off the tope of my head should the line
strSQL2 = "INSERT into Neww(a,b,c) Values (rs(0),rs(1),rs(2))"
read                                                                                                                          strSQL2 = "INSERT into Neww(a,b,c) Values (rs.fields(0),rs.fields(1),rs.fields(2))"

Paul Hartland



Message date : Nov 13 2003, 03:15 PM 
>From : Oleg_123 at xuppa.com 
To : accessd at databaseadvisors.com 
Copy to : 
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 


More information about the AccessD mailing list