Sub VulLijstBeschikbareDoc()
'*********************************************************
'Date : 22 juni 2005
'Input :
'Output :
'Comment: Deze procedure vult de lijst met beschikbare documenten.
'*********************************************************
Dim rstDoc As ADODB.Recordset
Dim rstDocKeuze As ADODB.Recordset
Dim sSQLDoc, sSQLDocKeuze As String
Dim i As Integer
i = 0
Set rstDoc = New ADODB.Recordset
Set rstDocKeuze = New ADODB.Recordset
sSQLDocKeuze = "SELECT tbl_IA_Doc_Keuzes.strKeuze FROM tbl_IA_Doc_Keuzes WHERE (tbl_IA_Doc_Keuzes.Volgnummer = " & Me.txtVolgnummer & ") AND (tbl_IA_Doc_Keuzes.Vertegenwoordiger = " & Me.Vertegenwoordiger & ") ORDER BY tbl_IA_Doc_Keuzes.strKeuze "
rstDocKeuze.Open sSQLDocKeuze, CurrentProject.Connection, adOpenStatic, adLockOptimistic
sSQLDoc = "SELECT tbl_ER_Documentatie.strDocumentatie, tbl_ER_Documentatie.lngVolgorde FROM tbl_ER_Documentatie ORDER BY tbl_ER_Documentatie.strDocumentatie"
rstDoc.Open sSQLDoc, CurrentProject.Connection, adOpenStatic, adLockOptimistic
rstDoc.MoveFirst
If Not (rstDocKeuze.BOF And rstDocKeuze.EOF) Then
MsgBox "The IF was TRUE, compare recordsets"
Do While Not rstDoc.EOF
rstDocKeuze.MoveFirst
'MsgBox (rstDocKeuze!strKeuze)
Do While Not rstDocKeuze.EOF
If rstDoc![strDocumentatie] = rstDocKeuze![strKeuze] Then
i = 1
End If
rstDocKeuze.MoveNext
Loop
If i = 0 Then
Me.lstBeschikbareDoc.AddItem rstDoc![strDocumentatie]
Else
i = 0
End If
rstDoc.MoveNext
Loop
Else
MsgBox "The IF was FALSE, show complete list"
Do While Not rstDoc.EOF
Me.lstBeschikbareDoc.AddItem rstDoc![strDocumentatie]
rstDoc.MoveNext
Loop
End If
rstDoc.Close
rstDocKeuze.Close
Set rstDoc = Nothing
Set rstDocKeuze = Nothing
End Sub