[AccessD] inserting in DAO

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Thu Nov 13 09:14:49 CST 2003


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




More information about the AccessD mailing list