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

records nevidation on sub form

Status
Not open for further replies.

smayshar

Programmer
Aug 30, 2003
42
AU
Hi, I have unbound main form with 2 bound sub forms. On the load of the main form I want to specificy the subforms record by the open args of the main form (I saw similar threads, I manage to get to the subform but it seems to be close for nevigation between the records)

thenks
 
Hallo,

Your subforms should be based on tables or queries which have a field (or several) in common with the table or query displayed in the main form.
If create the subforms first, then drag them into the main form, Access will set up the Child/Master link fields so that whenever the main form record changes, the subforms update to display the appropriate data.

ie. if you have a table of people with a PersonId (autonumber) and a table of pets indicating their OwnerId (the PersonId who owns them, base the pet subform on the pet table (no filtering), the main form on the person table, drag the pet subform onto the main form and the master link field will be set to PersonId and the child link field will be set to OwnerId and everything will be super,

- Frink
 
Thenks Frink,
In this case the main form is just for background and nice title the 2 subforms are individual with no logic connction

There are some options for the user to choose from and by this I would like to open the subforms record (make any sence ?)
 
Hallo,

Sorry I misread your original post.
What code do you use to set the recordsets for the subforms and what are their recordsources in Design view?

- Frink
 
smayshar:

Use a recordset and bookmark:

Dim rst As Recordset
Dim strCriteria

strCriteria = "FieldName = " & OpenArgs

With Forms!MainFormName!SubFormName.Form
Set rst = .RecordsetClone
rst.MoveFirst
rst.Find strCriteria, , adSearchForward
.Bookmark = rst.Bookmark
End With

Set rst = Nothing

-ttba
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top