Hi guys
I have a form, which is unbound to any table or query and has unbound controls that are populated with the values from ADO recordset. This ADO recordset is an instance of a class object. On the form i have certain fields (properies of the calss) displayed in text boxes, such as ID, Name, etc. and combo box, which allows user to select Name field and then form would display the remaining details in controls for the selected record.
Below is the simple code (establishment of connection, creation of recordset instance and etc. are executed in different subs). It runs fine except for the case when cursor reaches the EOF and assigns .AbsoluteProperty positionenum value -3 (which means EOF) and as my sub uses value of .absoluteposition to reference the ID of the record in the recordset and then to retrieve it and populate form controls it gives an error. I tried a number of ways to handle it but couldnt come up with anything workable. Please, help how to write a trap for .EOF error.
Thanks!
Private Sub cboGoTo_AfterUpdate()
'if recordset isn't empty move to selected in combo record in the local disconnected recordset
If Not rsBarriers.BOF And Not rsBarriers.EOF Then
rsBarriers.Find " [txtGICSIndustry] = '" & Me.cboGoTo & "'"
intCurrBarrierRecord = rsBarriers.AbsolutePosition
'add code to populate object with new current record
objBarriers.PopulatePropertiesFromRecordset rsBarriers
'populate the controls on the form with the current record
Call PopulateBarriersControls
End If
Exit Sub
End Sub