I have a multi-record form that needs to display the result of a query. The query itself is predefined and has come computed fileds, regarding to the original tables.
However, dependeing on criteria, only some of the records are to be presented.
My current code, which I believe isw ay out of line is below:
Dim IBool As Boolean
Dim strUserID As String, _
strFilterSQL As String, _
strFilter As String
Dim Q01_UserToDoTasksSet As DAO.Recordset
Set cdiDB = CurrentDb
'On Error GoTo ProcErrorFilter
strUserID = Nz(Forms![F91_LoggedUser]![CurrentUserID], "")
If strUserID <> "" Then
strFilterSQL = "SELECT * FROM Q01_UserToDoTasks WHERE " & "[Q01_UserToDoTasks].[T15_CurrentOwnerID] = " & strUserID
Else
strFilterSQL = "SELECT * FROM Q01_UserToDoTasks WHERE " & "[Q01_UserToDoTasks].[T15_CurrentOwnerID] = '###Impossivel###' "
End If
cdiDB.QueryDefs("Q01_UserToDoTasks").SQL = strFilterSQL
'Me.Form.RecordSource = "Q01_UserToDoTasks"
Set Q01_UserToDoTasksDef = cdiDB.QueryDefs("Q01_UserToDoTasks")
Set Q01_UserToDoTasksDefSet = Q01_FichasSelecionadasDef.OpenRecordset(dbOpenDynaset)
Me.Form.Recalc
Exit Sub
ProcErrorFilter:
IBool = InsertLog("F0001 Form_Load", "Load", "", "", "", 0, 0, strUserID, "Erro em Filtro. Filtro: '" & Me.Filter & "'")
The Query is Q01_UserToDoTasks and the record source of the form (this is its load event) is linked to the query.
I am getting the aobece circular reference error and can't tell what is wrong as I am a rookie on this pprogramming
can someone help?
same problem (with the 2 version). I actually pasted in in the code. The form has a recordsource set sou it should work with the second version.
I am attaching 2 screenshots as wel as the database so you can check better.
The form itself is "F0001_ListaToDoTasks" and the problem is on loading when there are no records to show for a user (he did not yet identified himself)
Now the forms open as blanks and not with the normal heeading /detail look