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

check if this one will work..

do until rsid.eof

'your code here

loop
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.