It looks like you might have a scope problem.
You have a few variables declared twice.
Global vairables:
----------------
Dim Avail As Recordset
Dim Assg As Recordset
Dim Idx2 As Integer
and in the private sub you also have local declarations:
------------------------------------
Dim Avail As DAO.Recordset
Dim Assg As DAO.Recordset
Dim Idx2 As Integer
I am kinda curious as to why you have global variables and why you use a function to open a record set.
Seems to me it would be easier to just use the sub.