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

viewing the same record when shifting between different forms

Status
Not open for further replies.

IANGRAND

Technical User
Jul 29, 2003
92
GB
Is there a way of viewing the same record when shifting between different forms.

ie if i am looking at record 2222 on form 1, then open form 2 i would like it to automatically be showing information on record 2222.

Cheers

Ian
 
Hello Ian,

This is a situation with many answers and the best one will be determined by what you are trying to accomplish.

If you are just trying to open a second form to the current record of your first form, then open the second form's recordset (query or SQL string) and add a criteria to the primary key field to filter the recordset.

Reference the primary key field on the first form:

Forms!frm1stForm!txtYourPKID

IF you are trying (not sure from your question) to keep the records in 2 forms synchronized, then using the same recordset.

Leave the second form's recordset blank and on its OnOpen event type:

Me.recordset = Forms!frm1stForm.recordset (substitute your object names)

If this isn't what you are looking for, then come back with more specifics.

Cheers
Bill
 
Just a caveat to the prior reply: I am not sure if you will be able to use the same recordset for 2 forms in this fashion if you are pre-A2K.

Cheers,
Bill
 
No sorry, lost me with this one.

Yes i am trying to open a second form to the current record of the first form. But im not sure how to go about adding a criteria to the primary key field to filter the recordset.

Any chance you could give a more detailed explanation.

Cheers

Ian

 
This is the way I do this thing. If I understood your problem correctly. The problem with this is that when you open a the second form you only get this one record as the recordset. So you can't move to a different record in the second form.


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "YourFrmName"

stLinkCriteria = "dbo_TABLE.ID = " + CStr(Me.id)

DoCmd.OpenForm stDocName, , , stLinkCriteria

 
no, thats my ideal. It would be great if the varying forms would show only the record visible on form1.

If you understand what i mean.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top