[AccessD] inserting in DAO (another problem)

Jim DeMarco Jdemarco at hshhp.org
Thu Nov 13 10:05:47 CST 2003


Oleg,

Add this line of code after it to see what your SQL string looks like.
Debug.Print strSQL2

Jim DeMarco

-----Original Message-----
From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com]
Sent: Thursday, November 13, 2003 11:00 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] inserting in DAO (another problem)


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


_______________________________________________
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".
***********************************************************************************



More information about the AccessD mailing list