0

Hello reader(s),

Here is my code:

Private Sub Combo1_Click()
Dim r
    conName.Provider = "Microsoft.Jet.OLEDB.4.0"
    conName.ConnectionString = App.Path & "\rosterdb.mdb"
    conName.CursorLocation = adUseClient
    conName.Open
   
rsid.Open "select * from DayWiseRoster", conName, adOpenDynamic, adLockOptimistic

' in below loop i got the problem. it prompts "loop without do"
Do While Not rsid.EOF

If rsid("rm_id") = Txtrostermnthid.Text Then

r = MsgBox("Shift of " & CboName.Text & " for the date of " & Label1.Caption & " have been saved. Do you want to update shift for " & CboName.Text & "", vbYesNo)

If r = vbYes Then

ssql = "update DayWiseRoster set shift=" & Combo1.Text & "where Date= ‘" & Text1.Text & "’"

rsdate.Open ssql, conName, adOpenDynamic, adLockOptimistic

Else
Exit Sub
CboName.SetFocus
End If
rsid.close
End if
rsid.MoveNext
Loop


     ssql2 = "INSERT INTO DayWiseRoster (rm_id) SELECT rostermnth_id FROM UserOfTheMonth where rmname='" & CboName.Text & "'"

    rsName.Open ssql2, conName, adOpenDynamic, adLockOptimistic

rsmnth.Open "select * from DayWiseRoster", conName, adOpenDynamic, adLockOptimistic

rsmnth.MoveFirst

   Do While Not rsmnth.EOF

If Txtrostermnthid.Text = rsmnth.Fields("rm_id") Then

rsmnth.Fields("Date").Value = Trim(Label1.Caption)
rsmnth.Fields("shift").Value = Trim(Combo1.Text)
rsmnth.Update

End If
   rsmnth.MoveNext
   Loop

conName.Close

Can you please help me for the first loop? Using VB 6.0 and Access.

Regards

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by cguan_77
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.