Find Record in Form without Filtering (1 Viewer)

tbasher

Registered User.
Local time
Today, 19:15
Joined
Jul 30, 2001
Messages
10
I would like to be able to click on a button from one form(Property) and open up a record in another form(Owner) where it ID is equal, and not using a filter. The Access wizard, open form with specific records feature only opens the records that equal that particular ID in a filter. I would like to avoid having to refresh the form to continue scrolling through the records.

This is what I have so far. Please Help! Thanks in advance! This is a button on the Property form.

Private Sub Command232_Click()
Dim rs As Recordset
Dim searchID

searchID = Me![PropertyID]

Set rs = Forms![Property].RecordsetClone
rs.Find strCriteria Like "[PropertyID]=searchID"
Forms![Owner].Bookmark = rs.Bookmark
Set rs = Nothing

End Sub
 

Matthew Snook

NW Salmon Database
Local time
Today, 19:15
Joined
Apr 19, 2001
Messages
133
Search for "synchronized forms" in the MSAccess help (F1). There is a section on using the "OnCurrent" event of the first form to maintain the synchronization of a secondary form. That probably has your answer. Here's the code:

Private Sub Form_Current()

' Declare and set a variable to store the WHERE
' clause that describes the records you want to
' display.
Dim strCond As String
strCond = "SupplierID = Forms!Suppliers!SupplierID"

' Use the IsLoaded function from the Northwind
' sample database to check whether the Products
' form is open, then set the properties.
If IsLoaded("Products") Then
Forms![Products].FilterOn = True
Forms![Products].Filter = strCond
End If

End Sub

Matt
 

Users who are viewing this thread

Top Bottom