Article ID: 119398
Article Last Modified on 11/6/2000
'**********************************************************
'Sub Form_Current()
'**********************************************************
'If the Product ID is blank, then exit the Sub.
If IsNull(Me![Product Id]) Then
Exit Sub
End If
'Dimension variables.
Dim formname As String, SyncCriteria As String
Dim f As Form, rs As Recordset
'Set the formname to "Products," the form that will be
'synchronized.
formname = "Products"
'Check to see if the Products form is open. If it
'is not open, open it.
If Not SysCmd(SYSCMD_GETOBJECTSTATE, A_FORM, formname) Then
DoCmd OpenForm formname
End If
'Define the form object and Recordset object for
'the Products form.
Set f = Forms(formname)
Set rs = f.RecordsetClone
'Define the criteria used for the synchronization.
SyncCriteria = "[Product Id]=" & Me![Product Id]
'Find the corresponding record in the Products form to
'the current record in the subform.
rs.FindFirst SyncCriteria
'If a record exists in the Products form, find the
'matching record.
If rs.nomatch Then
MsgBox "No match exists!", 64, formname
Else
f.bookmark = rs.bookmark
End If
'**********************************************************
'End Sub
'**********************************************************
Forms!Categories![Categories Subform].Form
Keywords: kbhowto kbusage KB119398