W
Wkatim
I've been trying for about a week now to figure out the code for this.
Here's what I'm doing - I have a form (frmSelectQuestions) with unbound combo
boxes filled in with values I entered. I want frmSelectQuestions to show
only records that correspond with the combo boxes. The info I want to filter
is on a form (frmSelectDropDown) that contains a subform
(frmToDoListGoalsDropDown). I want to filter by controls on both the form
and subform with just the one command button on frmSelectQuestions. I hope
this makes sense.
Here is my code. I keep getting that it can't find my field when it refers
to "Who" which is a field on the subform. I know I need to bring the focus
to the subform, at least I think. So, it's the txtWho and cmbWho I'm having
trouble with as the txtWho is located on the subform frmToDoListGoalsDropDown.
PLEASE HELP ME!!!!!!!!!!
Private Sub cmdPriority_Click()
On Error GoTo Err_cmdPriority_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSelectDropDown"
stLinkCriteria = "[MainGoals.Priority]=" & "'" & Me![cmbPriority] & "'"
And "[Where]=" & "'" & Me![cmbWhere] & "'" And
"Forms!frmSelectDropDown!frmToDoListGoalsDropDown.Form!txtWho=" & "'" &
Forms!frmSelectQuestions.cmbWho & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, stDocNameDone, acSaveNo
Exit_cmdPriority_Click:
Exit Sub
Err_cmdPriority_Click:
MsgBox Err.Description
Resume Exit_cmdPriority_Click
End Sub
Here's what I'm doing - I have a form (frmSelectQuestions) with unbound combo
boxes filled in with values I entered. I want frmSelectQuestions to show
only records that correspond with the combo boxes. The info I want to filter
is on a form (frmSelectDropDown) that contains a subform
(frmToDoListGoalsDropDown). I want to filter by controls on both the form
and subform with just the one command button on frmSelectQuestions. I hope
this makes sense.
Here is my code. I keep getting that it can't find my field when it refers
to "Who" which is a field on the subform. I know I need to bring the focus
to the subform, at least I think. So, it's the txtWho and cmbWho I'm having
trouble with as the txtWho is located on the subform frmToDoListGoalsDropDown.
PLEASE HELP ME!!!!!!!!!!
Private Sub cmdPriority_Click()
On Error GoTo Err_cmdPriority_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSelectDropDown"
stLinkCriteria = "[MainGoals.Priority]=" & "'" & Me![cmbPriority] & "'"
And "[Where]=" & "'" & Me![cmbWhere] & "'" And
"Forms!frmSelectDropDown!frmToDoListGoalsDropDown.Form!txtWho=" & "'" &
Forms!frmSelectQuestions.cmbWho & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, stDocNameDone, acSaveNo
Exit_cmdPriority_Click:
Exit Sub
Err_cmdPriority_Click:
MsgBox Err.Description
Resume Exit_cmdPriority_Click
End Sub