When I use the following code I get the message "Object doesn't support this property or method". What can I do about this?
Private Sub ID1_GotFocus()
' Find the next ID1 to be used if a new one is being input
Dim rst As Recordset
Dim strSearchID1 As String
Dim GroupUpperLim As String
Dim UpperLim As Integer
Dim strFirstChr As String
If IsNull(Me.ID1) Then
strFirstChr = Mid(Me.Name1, 1, 1)
strSearchID1 = strFirstChr & "*"
Me.RecordsetClone.Sort = "ID1"
Me.RecordsetClone.Find "ID1 LIKE " & strSearchID1
If Me.RecordsetClone.EOF Then
MsgBox "Record not found"
Else
Do While Mid(Me.RecordsetClone(ID1), 1, 1) = Mid(Me.Name1, 1, 1)
GroupUpperLim = Int(Mid(Me.RecordsetClone(ID1), 2, 3))
Loop
UpperLim = GroupUpperLim + 1
Me.ID1 = strFirstChr & Str(UpperLim)
End If
Me.RecordsetClone.Close
End If
End Sub
Private Sub ID1_GotFocus()
' Find the next ID1 to be used if a new one is being input
Dim rst As Recordset
Dim strSearchID1 As String
Dim GroupUpperLim As String
Dim UpperLim As Integer
Dim strFirstChr As String
If IsNull(Me.ID1) Then
strFirstChr = Mid(Me.Name1, 1, 1)
strSearchID1 = strFirstChr & "*"
Me.RecordsetClone.Sort = "ID1"
Me.RecordsetClone.Find "ID1 LIKE " & strSearchID1
If Me.RecordsetClone.EOF Then
MsgBox "Record not found"
Else
Do While Mid(Me.RecordsetClone(ID1), 1, 1) = Mid(Me.Name1, 1, 1)
GroupUpperLim = Int(Mid(Me.RecordsetClone(ID1), 2, 3))
Loop
UpperLim = GroupUpperLim + 1
Me.ID1 = strFirstChr & Str(UpperLim)
End If
Me.RecordsetClone.Close
End If
End Sub