I am trying to get rows from columns in a recordset and then inserting them into a table is simple and simple.
The entries are full, and I used .MoveFirst to start at the beginning of rs. However, I get EOF true at the very beginning, and it jumps out of do while.
I have a similar woorking function, but this one for some reason will not look.
I can’t understand why ... or how to fix it. Anny insight is welcome!
current code ~
Public Function makeSäljare()
'Create rs
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim sql As String
'Select what should be included in the rs.
rsData.Open "SELECT Forhandler, Selger FROM data", _
CurrentProject.Connection, adOpenDynamic, adLockOptimistic
rsData.MoveFirst
MsgBox rsData.GetString
'Manipulate each row of the result column.
Do While Not rsData.EOF
sql = "INSERT INTO säljare (Partner_Namn, Namn ) VALUES ('" & rsData!forhandler & "','" & rsData!Selger & "');"
MsgBox sql
'DoCmd.SetWarnings (False)
DoCmd.RunSQL (sql)
'DoCmd.SetWarnings (True)
rsData.MoveNext
'If rsData.EOF Then Exit Do
Loop
rsData.Close
End Function
He jumps into Do While Not rsData.EOF ..
source
share