[AccessD] inserting in DAO (another problem)

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Thu Nov 13 09:59:48 CST 2003


actually, not quite finished
strline field is a name field stripped of middle initial with no space
after coma, like "Bush,George". I need it to enter to an empty table.
Doesn't matter whether in one column or in 2.

however when I have 3 values (a,b,c) it tells me it not enough, when I put
4 (a,b,c,d) it tells me that number doesn't equal...


strSQL2 = "INSERT into Neww(a,b,c) Values (" & strLine & ", " & rs(1) & ",
" & rs(2) & ")"
---

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
strLine = FindAndReplace(CStr(strLine), Chr(39), Chr(39) + Chr(39))
strSQL2 = "INSERT into Neww(a,b,c) Values (" & strLine & ", " & rs(1) & ",
" & rs(2) & ")"

 ' strSQL2 = "INSERT into Neww(a,b,c,d) 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