When opening a recordset from code I dont think you can refer to forms, dont have access right now to actually test.
Instead of doing this
try something like
If not IsNull([Forms]![frmDocumentRegister]![FilterBy]) then
strSQL = strSQL = "[tblDocs].[Section] = " & [Forms]![frmDocumentRegister]![FilterBy]
endif [/code]
This should work if your section is a number.
For text:
And dates:
Remember that dates must be entered in US format ( MM/DD/YYYY )
Instead of doing this
Code:
strSQL = strSQL & " And ((IIf(IsNull([Forms]![frmDocumentRegister]![FilterBy]) , True, [tblDocs].[Section] = [Forms]![frmDocumentRegister]![FilterBy])) <> False) "
If not IsNull([Forms]![frmDocumentRegister]![FilterBy]) then
strSQL = strSQL = "[tblDocs].[Section] = " & [Forms]![frmDocumentRegister]![FilterBy]
endif [/code]
This should work if your section is a number.
For text:
Code:
If not IsNull([Forms]![frmDocumentRegister]![FilterBy]) then
strSQL = strSQL = "[tblDocs].[Section] = """ & [Forms]![frmDocumentRegister]![FilterBy] & """"
endif
Code:
If not IsNull([Forms]![frmDocumentRegister]![FilterBy]) then
strSQL = strSQL = "[tblDocs].[Section] = #" & [Forms]![frmDocumentRegister]![FilterBy] & "#"
endif