Is it possible to compare two objects of the same class directly to each
other?
In the code below I'm comparing "Search" against "oneForm.thisForm"... Both
of these objects are of the class "FormID". The IF statement never evaluates
to TRUE even if the three strings in the FormID object match. Trying to use
"=" instead of "IS" results in a error 438.
Basically I want to know if URL, Name and ID match. I could use AND and just
compare each in three evalations but that seems like more work than
necessary.
FormID:
- "URL" as string
- "Name" as string
- "ID" as string
HeldForm:
- "thisForm" as FormID
- "fields" as a collection of field data (not relevant to code below)
- "submit" as boolean
-- Code snippet --
'Find a form
'
' - Returns a HeldForm object
'
Public Function FindForm(Search As FormID) As HeldForm
Dim oneForm As HeldForm 'Holds data for one form
'Loop through all memorized forms for a match
For Each oneForm In Forms
'If our Search form matches a stored form...
If oneForm.thisForm is Search Then '<---This is never true.
'...set our return value to that form
Set FindForm = oneForm
End If
Next
End Function