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

How to make linked Sub Form to show linking field?

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I have a small problem if someone could help.

I have a main form 'Projects' with all projects details with an auto number key as Project ID and is based on the Projects table. I have created another form to show minutes of meetings relating to each project which is based on a query with Project ID as the linking field.

I have provided a command button on the main form to move to minutes screen of the relevant project. I have noticed that when I enter and save the main form and then switch over to sub form to add minutes, the sub form is unable to pick up the Project ID and does not let me add any records. However, If in the main form, if I move to next record and return to the previous and then use the command button, I could see the Project ID in the sub form and can add minutes. I am very perplexed why the sub form does not pick up Project ID as soon as I switch over. I am sure someone will have better understanding of this problem than me.
 
I assume you mean that when you open the subform with the main form still on screen you lose your ProjectID. If you don't mean this, this may solve your problem.

However, if it doesn't then make the default value of the ProjectID in the subform the ProjectID of the main form. Leave the main form open when you go to the subform, you can make it invisible, or minimised or whatever.

HTH
 
Thanks. I think (and I might be wrong) when you use a command button on the main form to open a sub form, main form stays open therefore when you close the sub form, it brings you back to where you started.

I added a save record code prior to opening the sub form which basically solves the problem. I am sure this is not the only solution. If there is something else, please do share.

DoCmd.RunCommand acCmdSaveRecord
stDocName = "Meetings SF"

stLinkCriteria = "[ProjectID]=" & Me![ProjectID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top