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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Page Form Problem

Status
Not open for further replies.

BubbaJean

IS-IT--Management
Jun 5, 2002
111
0
0
US
I have a Main Form with 6 pages/Tabs which I've loaded with subforms. Im trying to find a record on a subform (located on page 6) based on the value I selected in my list box
I created a list box on page six, but I don't know how to pass the value to the subform

Private

Private Sub Listbox_AfterUpdate()

Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[VenID] = " & Str(Me![ListBox])
Me.Bookmark = rs.Bookmark



Hope this make sense
 
The basic thing to remember is that a subform and a subform control aren't the same thing.

To refer to a subform control in a form, you use the same syntax you use for any control: Me![<subform control name>].

To refer to the actual subform, you use the subform control's Form property. This gives you access to the subform's properties and methods.

So what you want is:
Me![<subform control name>].Form.Bookmark = rs.Bookmark Rick Sprague
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
It is still not working, below is the revised code as well as my error code
Private Sub List57_AfterUpdate()

'Find record that matches the control
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst &quot;[VenID] = &quot; & Me![frmdeVendor].Form.Bookmark = rs.Bookmark


End Sub
Error message runtime error '91'
Object Variable of With block variable not set
Hope you can help
 
If your subform is based on a query, you can use the [VenID] in your query. When this field changes, you requery the subform in code and it will bring back your data.

On an &quot;AfterUpdate&quot; of the [VenID] field:

<subformname>.requery

This will update your subform.
 
Okay, I'm starting over, I have a form called frmdeVendor, which I've placed into a Multiple page Form called MainDataEntryForm. The subform (frmdeVendor) is based on a table which contains 1000 plus records (VenID). In order to enable the user to find a patriclar record, I wanted to create a list box via querying (VenID)on the page next to the form (frmdeVendor). That is the easy part, the part I can't do is pass the value from the list box to the frmdeVendor to get it to requery or find the record, does this make any since?? Please don't give up on me...
 
I don't know why you combined the FindFirst and Bookmark statements. Here is what it should be:
Code:
    rs.FindFirst &quot;[VenID] = &quot; & Me![List57]
    Me![frmdeVendor].Form.Bookmark = rs.Bookmark
Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top