rstC.MoveLast

j = rstC.RecordCount



Store =

Select Case Forms![]![].Form![]

Case 1, 3

= False

Case 2

= True

End Select





rstC.MoveFirst

'

flag = False

For i = 1 To j



'



If rstC![] = 0 Then

If flag = False Then

GoTo

End If



= Store



Set dbs = CurrentDb

strSQLTMP = "SELECT DISTINCTROW ., ., ., ., Max(.) AS FROM [] GROUP BY ., ., ., . HAVING (((.)=" & Forms![]![] & ") AND ((.)=" & rstC![] & ") AND ((.)<>0));"

Set rstTMP2 = dbs.OpenRecordset(strSQLTMP)



If rstTMP2.RecordCount >= 1 Then

GoTo label

'Else

'MsgBox (" ")

Exit Sub

End If

label:



rstTMP2.MoveLast

rstTMP2.Close



:

TMP2 = Format(Store, "m yy")

If flag = True Then '

rst.AddNew

rst![] = Forms![]![]

rst![] = Forms![]![].Form![]

rst![] = rstC![]

rst![] = Format(TMP2, "m yy")

rst![] = rstC![]

rst![] =



Msg = " " & (rstC![]) & " " & rstC![] & " "