open a form to child record using bound text box "on click"

L

lenox.noah

Here the problem~
I have a field "JobName" in a continous view, sub-form "sfrm_Jobs".
The sub-form is in "frm_Customers". I want to use the"JobName" field's
"on click" event to open "frm_Specs" and have it filter out everything
but the records relating to the "JobName" field. "JobID" is the
primary key. The wizard will set it up to open the form but I get an
error when I try to modify or create new records. The error message
says "Jet cannot find a record in the table 'tbl_Jobs' with key
matching field(s) 'JobID' "

Thanks in advance
 
L

lenox.noah

Here's the problem~
I have a field "JobName" in a continous view, sub-form "sfrm_Jobs". The sub-form is in "frm_Customers". I want to use the"JobName" field's
"on click" event to open "frm_Specs" and have it filter out everything but the records relating to the "JobName" field. "JobID" is the
primary key. The wizard will set it up to open the form but I get anerror when I try to modify or create new records. The error message
says "Jet cannot find a record in the table 'tbl_Jobs' with key matching field(s) 'JobID' "

Here's the code I'm using:

Private Sub Command54_Click()
On Error GoTo Err_Command54_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_Specs"

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

Exit_Command54_Click:
Exit Sub

Err_Command54_Click:
MsgBox Err.Description
Resume Exit_Command54_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top