Problems with "Filtering" when Open a Form

T

Tom

I have a problem with forms and subform.

TABLE STRUCTURE BACKGROUND INFO
- tblCompanies (a "Company" can have many "Contacts")
- tblContacts (a "Contact" can have many "Notes")
- tblNotes


FORMS BACKGROUND INFO:
- A main form (frmCompanies) is linked to "tblCompanies" (Single Form view)
- "frmCompanies" has a subform (sfrmContacts) that is linked to
"tblContacts". The sfrmContacts is also in "Single Form" view.
- "sfrmContacts" then also has a subform "sfrmNotes" (this the view is in
datasheet view).


PROCESS HOW RECORDS ARE SELECTED:
- I have another form "frmSelect" that only contains a combo box.
- The combo box contains the following AfterUpdate event (betweens the ***s)
- When frmSelect is opened, I can select a company name which then will open
the frmCompanies (and its underlying subforms).... so far so good!!!


************************

Private Sub cboCompany_AfterUpdate()

' Record Selection
If Not IsNull(Me.cboCompany) Then

If Me.Dirty Then
Me.Dirty = False
End If

Set rs = Me.RecordsetClone
rs.FindFirst "[CompanyName] = """ & Me.cboCompany & """"

If rs.NoMatch Then
MsgBox "Is this a New Record?"
Else
Me.Bookmark = rs.Bookmark
End If

Set rs = Nothing
End If


' Open sfrmCustomers
On Error GoTo Err_Command01_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCompanies"

stLinkCriteria = "[CompanyName]=" & "'" & Me![cboCompany] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command01_Click:
Exit Sub

Err_Command01_Click:
MsgBox Err.Description
Resume Exit_Command01_Click


End Sub

************************


HERE NOW IS THE PROBLEM:
- When a company name is selected from the frmSelect, the frmCompanies shows
"(Filtered") next to the navigation buttons. I expected this since I
selected a specific record from the entire record set of companies.
- However, if the selected company has "more than 1 contacts" I cannot
access any "contacts records except the 1st one.
- This does not happen if I don't use the frmSelect (the one w/ the combo
box).
If I directly open the frmCompanies I then would see the navigation buttons
for navigate back/forth between the Contacts.


QUESTION:
- Is there are way to utilize the frmSelect and allowing to SHOW ALL
contacts
that are "children" of the selected company?





Thanks,
Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top