Hi,
I am working on a billing database, where I have created a "Find" form where the user can select the criterias for the output of the report. I have used a public function which is as under and used in a query to populate the result :
And the query code goes as below :
Field : Selrec([billdate],[customername],[billmonth],[plan],[remarks])
Criteria : [Forms]![Find]![frmOptions]
However, I am getting the following error "This expression is typed incorrectly, or it is too complex to be evaluated."
I am attaching the database as well :
The table name is "Cust" from where the output result needs to be filtered.
Can anyone highlight what is wrong.
Thanks in advance.
Prashant
I am working on a billing database, where I have created a "Find" form where the user can select the criterias for the output of the report. I have used a public function which is as under and used in a query to populate the result :
Code:
Option Compare Database
Option Explicit
Public Function SelRec(billdate As Date, Customername As String, billmonth As String, Plan As String, Remarks As String) As Boolean
SelRec = False
If Not IsNull([Forms]![Find]![Start]) Then
If billdate < [Forms]![Find]![Start] Then Exit Function
End If
If Not IsNull([Forms]![Find]![End]) Then
If billdate > [Forms]![Find]![End] Then Exit Function
End If
If Not IsNull([Forms]![Find]![Customer]) Then
If Customername <> [Forms]![Find]![Customer] Then Exit Function
End If
If Not IsNull([Forms]![Find]![Month]) Then
If billmonth <> [Forms]![Find]![Month] Then Exit Function
End If
If Not IsNull([Forms]![Find]![Planname]) Then
If Plan <> [Forms]![Find]![Planname] Then Exit Function
End If
If Not IsNull([Forms]![Find]![Comments]) Then
If Remarks <> [Forms]![Find]![Comments] Then Exit Function
End If
SelRec = True
End Function
And the query code goes as below :
Field : Selrec([billdate],[customername],[billmonth],[plan],[remarks])
Criteria : [Forms]![Find]![frmOptions]
However, I am getting the following error "This expression is typed incorrectly, or it is too complex to be evaluated."
I am attaching the database as well :
The table name is "Cust" from where the output result needs to be filtered.
Can anyone highlight what is wrong.
Thanks in advance.
Prashant