G
Guest
Hi,
I'm trying every which was to search for a particular participant on my sub
form and am getting close, but...
The code below is executed after typing in the ppt_no in a small form and
clicking the Search button. It opens the subform I'm looking for, but what
I'd like it to do is open not just the sub-form, but the main form in which
it is usually housed.
The main form has the house address, etc. and the subform has the people who
live in the houses. I have been unable to search for a participant in
particular because it only searches through the people in the currently
displayed house.
I had tried doing something based on a parameter query that contains the
dwellingID and the particpant number (upon which I base the parameter), but
can't figure out how to take the results and say - display that dwelling.
That would be easy, because I would now the ppt is in that dwelling, so could
just scroll through the ppts.
In any case, this is my code for the other way of doing it via a form that
opens other form(s) based on what I input.
Thanks!
rivate Sub cmdSearch_Click()
Dim varWhere As Variant
varWhere = Null
If Not IsNull(Me.txt_ppt_no) Then
varWhere = "[ppt_no] LIKE '" & Me.txt_ppt_no & "*'"
End If
If IsNull(varWhere) Then
MsgBox "You must enter at least one search criteria.",
vbInformation, gstrAppTitle
Exit Sub
End If
If IsNull(DLookup("ppt_no", "tbl_participants", varWhere)) Then
MsgBox "No participant number found.", vbInformation, gstrAppTitle
Exit Sub
End If
DoCmd.OpenForm "sfrm_dwelling_ppts", WhereCondition:=varWhere
' Done
DoCmd.Close acForm, Me.Name
End Sub
I'm trying every which was to search for a particular participant on my sub
form and am getting close, but...
The code below is executed after typing in the ppt_no in a small form and
clicking the Search button. It opens the subform I'm looking for, but what
I'd like it to do is open not just the sub-form, but the main form in which
it is usually housed.
The main form has the house address, etc. and the subform has the people who
live in the houses. I have been unable to search for a participant in
particular because it only searches through the people in the currently
displayed house.
I had tried doing something based on a parameter query that contains the
dwellingID and the particpant number (upon which I base the parameter), but
can't figure out how to take the results and say - display that dwelling.
That would be easy, because I would now the ppt is in that dwelling, so could
just scroll through the ppts.
In any case, this is my code for the other way of doing it via a form that
opens other form(s) based on what I input.
Thanks!
rivate Sub cmdSearch_Click()
Dim varWhere As Variant
varWhere = Null
If Not IsNull(Me.txt_ppt_no) Then
varWhere = "[ppt_no] LIKE '" & Me.txt_ppt_no & "*'"
End If
If IsNull(varWhere) Then
MsgBox "You must enter at least one search criteria.",
vbInformation, gstrAppTitle
Exit Sub
End If
If IsNull(DLookup("ppt_no", "tbl_participants", varWhere)) Then
MsgBox "No participant number found.", vbInformation, gstrAppTitle
Exit Sub
End If
DoCmd.OpenForm "sfrm_dwelling_ppts", WhereCondition:=varWhere
' Done
DoCmd.Close acForm, Me.Name
End Sub