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!

How to refernce a control on a subform in a VB filter

Status
Not open for further replies.

jabmod

MIS
Sep 12, 2004
68
0
0
US
Question: I am trying to open a form from a subform.


Dim strDocName As String, strLinkCriteria As String

strLinkCriteria = "[IssueCount]= '" & Me![tblIssues_subform]![IssueCount] & "'"

DoCmd.OpenForm stDocName, , , stLinkCriteria

The result did not apply the filter.

Pls help.
Thanks
 
How are ya jabmod . . .

Try this:
Code:
[blue]strLinkCriteria = "[IssueCount]= '" & [tblIssues_subform][purple][b][i].Form[/i][/b][/purple]![IssueCount] & "'"[/blue]
Note: if [blue]IssueCount[/blue] is a [blue]numeric data type[/blue] then you only need:
Code:
[blue]strLinkCriteria = "[IssueCount] = " & [tblIssues_subform][purple][b][i].Form[/i][/b][/purple]![IssueCount][/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
TheAceMan1 - Thanks for the help. [IssueCount] is a number field (AutoNumber).

I used the syntax you suggested and I got an error that says

"Microsoft Office Access can't find the field '|' referred to in your expression"

Thanks
 
Dim strDocName As String, strLinkCriteria As String
[!]strDocName = "????"[/!]
strLinkCriteria = "IssueCount=" & Me!tblIssues_subform.Form!IssueCount
DoCmd.OpenForm st[!]r[/!]DocName, , , stLinkCriteria

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You won't belive this but I am still getting an error with the code below.
-------------------------
Private Sub IssueDetail_Click()
On Error GoTo Err_IssueDetail_Click

Dim strDocName As String, strLinkCriteria As String

strDocName = "frm_IssueDetail"
strLinkCriteria = "[IssueCount]=" & Me![tblIssues_subform].Form![IssueCount]

DoCmd.OpenForm strDocName, , , strLinkCriteria

Exit_IssueDetail_Click:
Exit Sub

Err_IssueDetail_Click:
MsgBox Err.Description
Resume Exit_IssueDetail_Click

End Sub
---------------------------
I am now getting the error msg: "Microsoft Office Access can't find the field 'tblIssues_subform' referred to in your expression"

My subform is a continous form. Beside each record is the button whose OnClick property has this code.

when u click on the button, another form "frm_IssueDetail" should open up that has teh same value in the "IssueCount" as the subform.

Thanks
JabMod


 
strLinkCriteria = "[IssueCount]=" & Me![IssueCount]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top