G
Guest
I have a main form for people that has a subform to load their addresses
which are multiple. How do I get the form to open to a specific address
(i.e. a default address). I want to avoid opening to the first address in
the recordset. The table for the addresses distinguishes them by an
"AddressType".
Here is the code I have developed so far but it gives me an error #3070
indicating that it does not recognize the field "Home". This is attached to
the main form's OnOpen event.
Dim sFrm As SubForm, recSet As DAO.Recordset
Set sFrm = Me!subfrmPeopleAndAddresses
Set recSet = sFrm.Form.RecordsetClone
recSet.FindFirst "[AddressTypeName] = Home"
If recSet.NoMatch Then
MsgBox "For some reason there is no Home Address"
Else
sFrm.Form.Bookmark = recSet.Bookmark
End If
Set recSet = Nothing
Thank you! Loren
which are multiple. How do I get the form to open to a specific address
(i.e. a default address). I want to avoid opening to the first address in
the recordset. The table for the addresses distinguishes them by an
"AddressType".
Here is the code I have developed so far but it gives me an error #3070
indicating that it does not recognize the field "Home". This is attached to
the main form's OnOpen event.
Dim sFrm As SubForm, recSet As DAO.Recordset
Set sFrm = Me!subfrmPeopleAndAddresses
Set recSet = sFrm.Form.RecordsetClone
recSet.FindFirst "[AddressTypeName] = Home"
If recSet.NoMatch Then
MsgBox "For some reason there is no Home Address"
Else
sFrm.Form.Bookmark = recSet.Bookmark
End If
Set recSet = Nothing
Thank you! Loren