bookmark in subform

D

deb

I am using a listbox to find a record. Person chooses the criteria in a
listbox and clicks the button and the record appears in the form. My main
form is fProject and the subform is f000Deliverable.

This works great in any main form. But now I am trying to use it in a
sub-form, and I get an error "Cant find the form f000Deliverable referred to
in a macro expression or VB code"

Private Sub ShowRecord4_Click()
Dim Rst As DAO.Recordset
' Store the recordset for the form.
' Set Rst = Forms!f000Deliverable.RecordsetClone
' Locate the record for the selected.

Rst.FindFirst "DelivID = " & List4

' Set the form's Bookmark property to move to the record.
Forms!f000Deliverable.Bookmark = Rst.Bookmark ' Problem starts is here

' Close the dialog box.
DoCmd.Close acForm, "f000DelivGoTo"
End Sub

Please help
 
C

Cheese_whiz

Hi deb,

I haven't done exactly what you are doing, but generally speaking you
reference a subform like this:

Forms!YourMainFormName!YourSubformControlName.Form

where
YourMainFormName = name of main form
YourSubformControlName = name of control on main form that holds subform

So, fix the above code to include your form's name and the subform control's
name, and then add .RecordsetClone to the end of it, I guess...

HTH,
CW
 
D

deb

That worked. Thank you
--
deb


Cheese_whiz said:
Hi deb,

I haven't done exactly what you are doing, but generally speaking you
reference a subform like this:

Forms!YourMainFormName!YourSubformControlName.Form

where
YourMainFormName = name of main form
YourSubformControlName = name of control on main form that holds subform

So, fix the above code to include your form's name and the subform control's
name, and then add .RecordsetClone to the end of it, I guess...

HTH,
CW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top