J
Joseph Ellis
Hello all,
I have a church directory database that consists of two tables:
tblHouseholds and tblIndividuals. Each household can have many
individuals. The tables are in a one-to-many relationship, linked by
the primary key "hhID' in tblHouseholds. So, every household has an
hhID, and each individual in that household has the same hhID (as well
as their own "IndivID").
I have a main form (frmHouseholds) whose record source is
tblHouseholds which contains a subform (frmIndividuals) whose record
source is tblIndividuals. I've made (with lots of help from this
group) a rudimentary search engine which uses OpenForm to pop up a
Search Results form (frmSearchResults):
DoCmd.OpenForm "frmSearchResults", , , strWhere,
acFormReadOnly, acDialog
This is a continuous form which lists all the records that match the
search criteria, and has as its record source tblIndividuals.
The problem is that even though this form properly displays hhID for
each individual, when I try to use hhID to do a FindFirst on the main
form, I get an error due to the fact that hhID is null.
Dim rst As DAO.Recordset
With Forms!frmHouseholds
Set rst = .RecordsetClone
rst.FindFirst "[hhID] = " & Forms!frmSearchResults.hhID
If Not rst.NoMatch Then
.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End With
Just for the heck of it, I even made a little button on
frmSearchResults that pops up a message box listing the first name,
last name, IndivID, and hhID of whichever record I click on. The
value for hhID is always blank, even though each record's hhID is
clearly displayed in the form.
What am I missing here?
Thanks,
Joseph
I have a church directory database that consists of two tables:
tblHouseholds and tblIndividuals. Each household can have many
individuals. The tables are in a one-to-many relationship, linked by
the primary key "hhID' in tblHouseholds. So, every household has an
hhID, and each individual in that household has the same hhID (as well
as their own "IndivID").
I have a main form (frmHouseholds) whose record source is
tblHouseholds which contains a subform (frmIndividuals) whose record
source is tblIndividuals. I've made (with lots of help from this
group) a rudimentary search engine which uses OpenForm to pop up a
Search Results form (frmSearchResults):
DoCmd.OpenForm "frmSearchResults", , , strWhere,
acFormReadOnly, acDialog
This is a continuous form which lists all the records that match the
search criteria, and has as its record source tblIndividuals.
The problem is that even though this form properly displays hhID for
each individual, when I try to use hhID to do a FindFirst on the main
form, I get an error due to the fact that hhID is null.
Dim rst As DAO.Recordset
With Forms!frmHouseholds
Set rst = .RecordsetClone
rst.FindFirst "[hhID] = " & Forms!frmSearchResults.hhID
If Not rst.NoMatch Then
.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End With
Just for the heck of it, I even made a little button on
frmSearchResults that pops up a message box listing the first name,
last name, IndivID, and hhID of whichever record I click on. The
value for hhID is always blank, even though each record's hhID is
clearly displayed in the form.
What am I missing here?
Thanks,
Joseph