Help with linking forms. Thanks!

Brad108

Registered User.
Local time
Today, 07:38
Joined
Jan 26, 2007
Messages
28
Hi

When I change from my company screen to the contact screen, i have managed to get it to opne the contact form with the contact details from the previos screen.

This is in my code to do this:

stLinkCriteria = "[ContactID]=" & Me![ContactID]
stDocName = "Contacts"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

However, when I try and do it the other way around with this:

stLinkCriteria = "[CompaniesID]=" & Me![CompanyID]
stDocName = "Company"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub

Its coming up with a compile error.

However I have tried to put it in so that I can do the same from contact to company (i.e. when I am on a contacts details, I can click there company name and it goes to the company screen showing there details). The company index field on the contacts table is called 'CompanyID' and the company index field on the company table is called 'CompaniesID'.

Anyone know what I am doing wrong?

Appreciate your help with this, I am very new to Access.

Thanks

Brad
 
Please let me know if you need any more info on this.

This should be an easy one, but I can't work it out.

Just to clarify, what I want to do is:

Open Contact form, choose contact. Click on contact company and then this opens the Company form, showing details of that particular company. At the moment the company form opens, but it just shows the first record.

Thanks

Brad
 

Users who are viewing this thread

Back
Top Bottom