I've read through the forum and can't find anything that helps me with my problem. So I'll lay it out here. I have a form that I'm using to look for a record based on the selection of 2 different combo boxes. One combo box is for a Group Name and the other is for the Year. I'm trying to create a string to lookup the record, but after I make the selection, I'm given an error of Invalid Use of Null. Here is the code that I'm using. The New Renewal ID is an autonumber, and then the Group Name is a text field, and the Next anniversary date is a date field.
Code:
Private Sub YearCombo_Change()
Dim strFind As String
'-- Use DLookup() to locate the unique [New Renewal ID] we need
strFind = DLookup("[New Renewal ID]", "[Table New Renewal]", "([GRGR_NAME] = " & fHandleApostrophe(Me!GroupInfo) & ") And ([GRGR_NEXT_ANNV_DT] = " & Me!YearCombo & ")")
'-- Now locate the record
Me.RecordsetClone.FindFirst "[New Renewal ID] = " & strFind
If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
MsgBox "Could not find!"
End If
End Sub
I have it searching using the on change function of the 2nd combo box. Please help me figure out what Invalid Use of Null means. Thanks.
Also, I have another function in the code that removes apostrophes because I was receiving another error that caused me to use it.