problmes with vba code

M

maarten

this is code to give a value to checkboxes when you click
on a button to open a form.

It only fill in one check box in stead of more, can
someone tell me wat i do wrong.

-----------------------------------------------------------

Set db = CurrentDb
Set rs = db.OpenRecordset("select * from tblfirmaID where
firmaID = " & intfirmaID)
Set rs2 = db.OpenRecordset("select * from tblcategorie")
lngID = rs2!ID

If Not rs.RecordCount = 0 Then
rs.MoveFirst
Do Until rs.EOF = True
Do Until rs2.EOF = True
MsgBox rs!categorieID
'rs.MoveNext
If rs2!ID = rs!categorieID Then
MsgBox "komt overeen"
rs2.Edit
rs2!add = True
rs2.Update
'rs2.MoveNext
'MsgBox rs2!add
Else
MsgBox "komt niet overeen"
rs2.Edit
rs2!add = False
rs2.Update
'rs2.MoveNext
'MsgBox rs2!add
End If
rs2.MoveNext
Loop
rs2.MoveFirst
strtest = strtest & vbCrLf & rs!firmaID
rs.MoveNext
' MsgBox rs!ID
Loop
MsgBox strtest
DoCmd.OpenForm "frmaddcategorie", acNormal, , ,
acReadOnly, , Me.ID.Value
Else
DoCmd.OpenForm "frmaddcategorie", acNormal, , ,
acReadOnly, , Me.ID.Value
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top