how to insert a value in a foreignkey?

pretoria

Registered User.
Local time
Today, 21:43
Joined
Jul 23, 2005
Messages
30
Hello,

From a subform I'm opening a popup form to a new record. Except the new record must insert the CustFK value. Right now its just filtering the record set. How can I insert the CustID value in the DoCmd.GoToRecord , , acNewRec form?? see VBA code below.


Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ComDetail"

stLinkCriteria = "[CustFK]=" & Me![CustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
 
Hum..

I don't think you want to link this to the main form. I would simply have the form pop up in data entry mode, displaying a new record and set the default value of the custID to the same fld in the main form...

:confused:
 
works

Excellent. Works!
Thanks.
 

Users who are viewing this thread

Back
Top Bottom