Open Sesame (1 Viewer)

Angello Pimental

Registered User.
Local time
Today, 19:20
Joined
May 9, 2001
Messages
92
The following code opens up a form to a particular record once a user clicks on the name of that particular record.
My problem is that I want to open up the entire record set but still initially have the record the user chose come up first.
Is this possible?
Any help would be great, Thnx

Private Sub Listofdomainnames_Click()
On Error GoTo Err_Listofdomainnames_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RealForm"

stLinkCriteria = "[Domain]=" & "'" & Me![Listofdomainnames] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_Listofdomainnames_Click:
Exit Sub

Err_Listofdomainnames_Click:
MsgBox Err.Description
Resume Exit_Listofdomainnames_Click
End Sub
 

raskew

AWF VIP
Local time
Today, 13:20
Joined
Jun 2, 2001
Messages
2,734
The SynchronizeForm method will open the form and move to the desired record without filtering the record set.

Public Function SychronizeForm(MySubForm As String, MyCriteria As String)

'Calling procedure: Call SychronizeForm([forms]![frmPopStruc],"SSN = Me![By Search Type]")
'Dimension variables.
Dim FormName As String, SyncCriteria As String
Dim FirstCriteria As String, NextCriteria As String
Dim F As Form, rs As Recordset

'Set the formname to the form that will be
'synchronized.
FormName = MySubForm

'Check to see if the form is open. If it
'is not open, open it.
If Not SysCmd(acSysCmdGetObjectState, acForm, FormName) Then
DoCmd.OpenForm FormName
End If

'Define the form object and Recordset object for
'the form.
Set F = Forms(FormName)
Set rs = F.RecordsetClone

'Define the criteria used for the synchronization.

SyncCriteria = MyCriteria
'ALTERNATIVES:
'SyncCriteria = BuildCriteria("SSN", dbText, Me![By Search Type])
'SyncCriteria = "SSN = Me![By Search Type]"

rs.FindFirst SyncCriteria

If rs.NoMatch Then
MsgBox "No match exists!", 64, FormName
Else
F.Bookmark = rs.Bookmark
End If
End Function
 

Users who are viewing this thread

Top Bottom