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

Related Control not picking up value from previous form

Status
Not open for further replies.

nlc

Technical User
Mar 20, 2002
6
0
0
US
Hello -
I have a database with a form with company/contact information. When you click a button, a form with the product (previous orders) information opens up.

My problem is that when you enter new information into the product information form, it will not save because the Company ID field hasn't been filled in. The tables the forms are based on are related, on that field, everything seems correct.

The row source for that control reads as follows:

SELECT [Contacts].[Company ID] FROM Contacts;

The Event procedure for the button that opens the product id form is as follows:

Private Sub Open_Product_Information_Form_Click()
On Error GoTo Err_Open_Product_Information_Form_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Product Information"

stLinkCriteria = "[Company ID]=" & Me![Company ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Open_Product_Information_Form_Click:
Exit Sub

Err_Open_Product_Information_Form_Click:
MsgBox Err.Description
Resume Exit_Open_Product_Information_Form_Click

End Sub

I'd really prefer not to even have the contact id visible on the form, but I definitely don't want users to have to fill it in...

Any suggestions????

Thank you,
Jeannie


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top