G
Ge
Hi all.
In my lousy engelish, I will try to explain my problem.
In my form with a subform, I would like to update all record in the subform
with a value entered in a field (cboPakkevalg) in the main form. In the
subform I can select wich record to update with a checkbox(Behandles=True)
for each record. This value wil be reset to False during the update. (The
whole idea is to move several sub records from one main record to an another
main record by changing the walue in the "childfield" (main/sub)).
Anyway, I have this "On Click" sub, and the problem is; I can update all
selected records except the "last one". This occur if I have selected more
than one subrecord to move.
Eg; I will move 10 subrecords. I will have to click twice; First for the
record 1 - 9, and once more for the record 10
I see the message "EOF have been reached..." when the pointer are at the
..EOF record, but i seems that this record are not updated when the Me.Requery
are done. When 1 record are selected, I see the same message, but here the
record are uppdated....
Please look at my sub, and help me find what I am doing wrong... Thanks for
any help!!!!
*********
Private Sub cmd1_Click()
On Error GoTo cmdOverfor_Err
Dim rsTabell As New ADODB.Recordset
Dim SQLStreng As String
SQLStreng = "SELECT Tabell.* FROM Kabel WHERE ((Tabell.Behandles) = True)"
rsTabell.Open SQLStreng, CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
'rsTabell.MoveFirst
Do Until rsTabell.EOF
rsTabell![Pakke] = Me.cbopakkeValg.Value
rsTabell![Behandles] = False
rsTabell.Update
rsTabell.MoveNext
If rsTabell.EOF Then
MsgBox "EOF have been reached...", vbOKOnly, "OK"
End If
Loop 'While Not rsTabell.EOF
rsTabell.Close
Set rsTabell = Nothing
Me.Requery
Exit Sub
cmdOverfor_Err:
MsgBox "Error during update: " & Err.Description, vbCritical,
"System-feil"
End Sub
In my lousy engelish, I will try to explain my problem.
In my form with a subform, I would like to update all record in the subform
with a value entered in a field (cboPakkevalg) in the main form. In the
subform I can select wich record to update with a checkbox(Behandles=True)
for each record. This value wil be reset to False during the update. (The
whole idea is to move several sub records from one main record to an another
main record by changing the walue in the "childfield" (main/sub)).
Anyway, I have this "On Click" sub, and the problem is; I can update all
selected records except the "last one". This occur if I have selected more
than one subrecord to move.
Eg; I will move 10 subrecords. I will have to click twice; First for the
record 1 - 9, and once more for the record 10
I see the message "EOF have been reached..." when the pointer are at the
..EOF record, but i seems that this record are not updated when the Me.Requery
are done. When 1 record are selected, I see the same message, but here the
record are uppdated....
Please look at my sub, and help me find what I am doing wrong... Thanks for
any help!!!!
*********
Private Sub cmd1_Click()
On Error GoTo cmdOverfor_Err
Dim rsTabell As New ADODB.Recordset
Dim SQLStreng As String
SQLStreng = "SELECT Tabell.* FROM Kabel WHERE ((Tabell.Behandles) = True)"
rsTabell.Open SQLStreng, CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
'rsTabell.MoveFirst
Do Until rsTabell.EOF
rsTabell![Pakke] = Me.cbopakkeValg.Value
rsTabell![Behandles] = False
rsTabell.Update
rsTabell.MoveNext
If rsTabell.EOF Then
MsgBox "EOF have been reached...", vbOKOnly, "OK"
End If
Loop 'While Not rsTabell.EOF
rsTabell.Close
Set rsTabell = Nothing
Me.Requery
Exit Sub
cmdOverfor_Err:
MsgBox "Error during update: " & Err.Description, vbCritical,
"System-feil"
End Sub