Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Runtime-error 3021: No current record" comes up in subform

Status
Not open for further replies.

ricmart

MIS
Nov 12, 2002
7
US
I have a form called frmpolines that is used as a subform inside a form called frmPoheader. This subform has a combo box control (cboItemNo) that will populate some text boxes when a user selects from the combo box. I used the wizard to create the code in the combo box - see below. When I open the subform (frmpolines) by itself it works fine. I'm able to select an item from the combo box and the appropriate text boxes get populated. However, when I open the main form (frmPoheader) and I select from the combobox(cboitemNo) in the subform I get the runtime-error 3021. I can't figure out why I get that. Any help would be greatly appreciated.

Private Sub cboItemNo_AfterUpdate()
Dim rs As Object

Set rs = Me.RecordsetClone
rs.findfirst "[ItemNo] = '" & Me![cboItemNo] & "'"
--->Me.Bookmark = rs.Bookmark <----'highlighted in debug
If Not IsNull([ItemNo]) Then
Call get_pic([cboItemNo], Image1)
End If
Call configsizes
End Sub
 
Hi ricmart,

Just my 2 cents:

The error is because the subform is not populated with any records (i.e. Me!RecordsetClone.RecordCount < 1)

Might take a look at the 'Link Child Fields' and 'Link Master Fields' setting for the sub and main forms. I suspect there is a problem with the linking fields, and the subform is not populating any records. That is why it works when you run the subform by itself, and not when it is run with the main form.

Just a thought!

Rick
 
Good point rickgrimes and thank you for your 2 cents.
Unfortuneately I failed to mention some details about my problem, my fault. I do not have the two forms linked because for this particular application I do not need to have them linked, at least not at this point in the development. The subform's data source is a table called &quot;tblproducts&quot;. The main form's data source is a table - &quot;tblVendors&quot;. The table - &quot;tblproducts&quot; has about 3,000 records in it. The user will select a vendor from the combo box on the main form, then he/she will select a product from the combo box in the subform. That's when I get the error, but like I said only when I open the main form. Hope this provides a little more info on this problem.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top