Private Sub cmbJaar_AfterUpdate()
Dim adorst As ADODB.Recordset
Dim adocmd As New ADODB.Command
Set adorst = New ADODB.Recordset
adorst.Open "SELECT tblJaarMaand.intJaarId FROM tblJaarMaand WHERE (((tblJaarMaand.idsJaarMaandId)=" + CStr(txtMaand.Value) + "));", CurrentProject.Connection, adOpenStatic
If CInt(cmbJaar.Value) <> adorst("intJaarId").Value Then
Set adocmd.ActiveConnection = CurrentProject.Connection
adorst.Close
adorst.Open "SELECT tblJaarMaand.idsJaarMaandId FROM tblJaarMaand WHERE (((tblJaarMaand.intJaarId)=" + CStr(cmbJaar.Value) + ") AND ((tblJaarMaand.intMaandId)=" + CStr(cmbMaand.Value) + "));", CurrentProject.Connection, adOpenStatic
adocmd.CommandText = "UPDATE tblFirma SET tblFirma.intMaandId=" + CStr(adorst("idsJaarMaandId").Value) + " WHERE (((tblFirma.idsFirmaId)=" + CStr(Form_frmFirmalijst.cmbFirma.Value) + "));"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Refresh
[I][B]DoCmd.Execute[/B][/I]
End If
adorst.Close