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!

How to link to the same data? 1

Status
Not open for further replies.

markswan20

Technical User
Jun 17, 2005
58
GB
Hi everyone.

I have a pretty basic problem which has bugged me for a little while.

I have a database that has numerous pages lets say i'm on record number 10 when I open a page from my form it automatically defaults to the first record in the database. is it possible to automatically open the record information which i'm on at the time of opening?

Cheers Mark
 
Thank you THWatson for your reply.

I'm a little confused as to where the code goes.

The form it'll be placed upon is called customers_data the form it is linked to is called Additional_Details.

Is it possible to elaborate upon this.

Thank you for your time
Mark
 
Mark
Know what? I think I misinterpreted your initial question. Let's have another go at it.

I need to picture what you have. Is this it?
You have a form called "customers_data" and it has 10 tab pages. One of those tabbed pages has a subform called "Additional-Details." So you're on Record 10, but when you go to the page that has the "Additional_Details" subform, you end up at Record 1.

If that's the case, then it would sound as if the form and subform aren't fully linked.

Tom



 
Apologies for the time i've taken to submit your requested information.

You are right Tom in heinsight i have 1 form with additional form linked to my main 1 using command buttons, I am on record 10 i press a command button that takes me to an additional sheet but the default form that gets displayed is record 1 not record 10 as required.

Hope this helps Tom

Kind Regards
Mark
 
Mark
What is the code behind your command button?

Tom
 
Mark
If the forms are linked, and you use the command button wizard to go from one form to another...and when you set up the command button use the option "Open the form and find specific data to display" and make the link between two fields, it will work.

For example, two forms, Form13 and Form22, are linked by EmployeeID. Here is the code that opens Form22 and takes you directly to the record you are on in Form13.

Code:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Form22"
    
    stLinkCriteria = "[EmployeeID]=" & Me![EmployeeID]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    
Exit_Command5_Click:
    Exit Sub

Err_Command5_Click:
    MsgBox Err.Description
    Resume Exit_Command5_Click
    
End Sub

Hope that helps.

Tom
 
Thank you Tom I have managed to get my problem working now.

It's taken me a while.

Thanks again.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top