Zie bijlage
Het lukt mij niet om simpele controle wanneer 3 of 4,5,6 gegevens
overeenkomen vanuit 2 tbl en uitslag te updaten
zie form controle
Mvg
ANayon project:shocked:
Het lukt mij niet om simpele controle wanneer 3 of 4,5,6 gegevens
overeenkomen vanuit 2 tbl en uitslag te updaten
zie form controle
Code:
Option Compare Database
Option Explicit
Dim DB As Database
Dim Rs1 As Recordset
Dim Rs2 As Recordset
Dim Sql1 As String
Dim Sql2 As String
Dim Hlp_RecCount1 As Long
Dim Hlp_RecCount2 As Long
Dim Hlp_CombiCount As Long
Private Sub Form_Load()
Knp_Start_Click
End Sub
Private Sub Knp_Start_Click()
On Error GoTo Err_Knp_Start_Click
Dim Hlp_Line As String
'
'Nodig om de tabellen te kunnen benaderen
Set DB = CurrentDb
DoCmd.Hourglass True ' laat een zandloper zien
DoCmd.OpenForm "Frm_Verloop", , , "" 'laat een popup-scherm zien met kommentaar
Sql1 = "Select * from laatstetrekking Order by teller desc"
Set Rs1 = DB.OpenRecordset(Sql1, dbOpenDynaset)
Hlp_RecCount1 = 0
While Not Rs1.EOF
Hlp_RecCount1 = Hlp_RecCount1 + 1
Sql2 = "Select * from Gewoonfull where teller < " & Rs1!teller
Sql2 = Sql2 & " Order by teller desc"
Set Rs2 = DB.OpenRecordset(Sql2, dbOpenSnapshot)
Hlp_RecCount2 = 0
While Not Rs2.EOF
Hlp_RecCount2 = Hlp_RecCount2 + 1
Forms![FRM_Verloop]!Veld_Weergave = "Aantal ingelezen records waar3,4,5,5+,6 " & Hlp_RecCount1 & " / " & Hlp_RecCount2
Hlp_CombiCount = 0
If Rs1!BAL1 = Rs2!BAL1 Or Rs1!BAL1 = Rs2!BAL2 Or Rs1!BAL1 = Rs2!BAL3 Or _
Rs1!BAL1 = Rs2!BAL4 Or Rs1!BAL1 = Rs2!BAL5 Or Rs1!BAL1 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
If Rs1!BAL2 = Rs2!BAL1 Or Rs1!BAL2 = Rs2!BAL2 Or Rs1!BAL2 = Rs2!BAL3 Or _
Rs1!BAL2 = Rs2!BAL4 Or Rs1!BAL2 = Rs2!BAL5 Or Rs1!BAL2 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
If Rs1!BAL3 = Rs2!BAL1 Or Rs1!BAL3 = Rs2!BAL2 Or Rs1!BAL3 = Rs2!BAL3 Or _
Rs1!BAL3 = Rs2!BAL4 Or Rs1!BAL3 = Rs2!BAL5 Or Rs1!BAL3 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
If Rs1!BAL4 = Rs2!BAL1 Or Rs1!BAL4 = Rs2!BAL2 Or Rs1!BAL4 = Rs2!BAL3 Or _
Rs1!BAL4 = Rs2!BAL4 Or Rs1!BAL4 = Rs2!BAL5 Or Rs1!BAL4 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
If Rs1!BAL5 = Rs2!BAL1 Or Rs1!BAL5 = Rs2!BAL2 Or Rs1!BAL5 = Rs2!BAL3 Or _
Rs1!BAL5 = Rs2!BAL4 Or Rs1!BAL5 = Rs2!BAL5 Or Rs1!BAL5 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
If Hlp_CombiCount < 5 Then
If Rs1!BAL6 = Rs2!BAL1 Or Rs1!BAL6 = Rs2!BAL2 Or Rs1!BAL6 = Rs2!BAL3 Or _
Rs1!BAL6 = Rs2!BAL4 Or Rs1!BAL6 = Rs2!BAL5 Or Rs1!BAL6 = Rs2!BAL6 Then
Hlp_CombiCount = Hlp_CombiCount + 1
End If
End If
If Hlp_CombiCount = 5 Or Hlp_CombiCount = 6 Then
Rs1.Edit
Rs1!full6 = Hlp_CombiCount
Rs1.Update
GoTo Move_Next_Rs2
Else
Rs2.MoveNext
End If
If Hlp_RecCount1 = 5000 Then
DoCmd.Close acForm, "Frm_Verloop"
DoCmd.Hourglass False
DoCmd.Close acForm, "controle"
Exit_Knp_Start_Click:
Exit Sub
End If
Wend
Move_Next_Rs2:
Rs2.MoveNext
Wend
Err_Knp_Start_Click:
'Resume Next
MsgBox Err.Description
Resume Next
Resume Exit_Knp_Start_Click
End Sub
Mvg
ANayon project:shocked:
Bijlagen
Laatst bewerkt door een moderator: