Can't find error

J

jon

Hi
On a form I want to open another form with the relevant information from the
selected information in a subform.
When I run the code I get an error saying it can't find the field
'Top10failingComponetes subform' referred to in your expression.

I have try several times to make sure all is right but to no avail.
I have pasted the code below.

Thanks

Jon


Private Sub cmbAnnalisisForm_Click()
On Error GoTo Err_cmbAnnalisisForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm-Componet-Annalisis"

With Me.[Top10FailingComponetes subform].Form![Job]
If IsNull(.Value) Then
Else
stLinkCriteria = "[job]=" & .Value
DoCmd.OpenForm stDocName, WhereCondition:=stLinkCriteria
End If
End With



Exit_cmbAnnalisisForm_Click:
Exit Sub

Err_cmbAnnalisisForm_Click:
MsgBox Err.Description
Resume Exit_cmbAnnalisisForm_Click

End Sub
 
W

Wayne-I-M

Hi

I am not sure what you are trying to do with this
If IsNull(.Value) Then
Else
as it will not do anything

Try taking the If off and just use something like this


Private Sub cmbAnnalisisForm_Click()
DoCmd.OpenForm "Frm-Componet-Annalisis", acNormal, "", "[job]=[Forms]![MAIN
FORM NAME]![SUB FORM NAME].[Form]![job]", , acNormal
End Sub

Change MAIN FORM NAME and SUB FORM NAME to what they really are.


Once you get this to work then you can add extra "stuff" later. At least
this will let you know if the links are OK.
Ensure that there a field named [job] on each form - this is NOT the name of
the table field it is based on but it is the name of the form control.




--
Wayne
Manchester, England.



jon said:
Hi
On a form I want to open another form with the relevant information from the
selected information in a subform.
When I run the code I get an error saying it can't find the field
'Top10failingComponetes subform' referred to in your expression.

I have try several times to make sure all is right but to no avail.
I have pasted the code below.

Thanks

Jon


Private Sub cmbAnnalisisForm_Click()
On Error GoTo Err_cmbAnnalisisForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Frm-Componet-Annalisis"

With Me.[Top10FailingComponetes subform].Form![Job]
If IsNull(.Value) Then
Else
stLinkCriteria = "[job]=" & .Value
DoCmd.OpenForm stDocName, WhereCondition:=stLinkCriteria
End If
End With



Exit_cmbAnnalisisForm_Click:
Exit Sub

Err_cmbAnnalisisForm_Click:
MsgBox Err.Description
Resume Exit_cmbAnnalisisForm_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