I have a table and two queries (one filtering out the active status, and the other filtering out pending status from the table). If an active record has had a change made to it, or if a record has pending status, then the Order id has an extension, so I have a field that contains only the base id.
I have a third query which joins the active query and the pending query via the base id field. It contains all the active records, and only those records from the pending query that matches base id in the active query.
I want to indicate whether the record is pending because its date was extended. I have a function that passes in pending end date and the active end date, compares them and returns the appropriate string. However, when dealing with the active records that do not have matching base ids in the pending table, the function returns #Error. I believe it is because of the value passed in for the pending end date isn't valid/present.
I would like to perform a check that performs the If statement only if the base id is in the pending query or if need be if the value passed in is valid. I've tried checking for null values, the nz()option, and dCount>0. This is the current version of the code:
Any help would be appreciated.
I have a third query which joins the active query and the pending query via the base id field. It contains all the active records, and only those records from the pending query that matches base id in the active query.
I want to indicate whether the record is pending because its date was extended. I have a function that passes in pending end date and the active end date, compares them and returns the appropriate string. However, when dealing with the active records that do not have matching base ids in the pending table, the function returns #Error. I believe it is because of the value passed in for the pending end date isn't valid/present.
I would like to perform a check that performs the If statement only if the base id is in the pending query or if need be if the value passed in is valid. I've tried checking for null values, the nz()option, and dCount>0. This is the current version of the code:
Code:
Function IsExt(varBaseID As String,
dtCOEndDate As Date, dtActEndDate As Date) As String
If (IsBaseIDInPending(varBaseID) = True) Then
If (dtCOEndDate > dtActEndDate) Then
IsExt = "EXT"
Else
IsExt = "Not EXT"
End If
Else 'not needed, just to replace the #Error for now.
IsExt = "Blank"
End If
End Function
Comment