Hi,
I have a table named Printers. Now, I have created a form called Printers. On this form there is a subform show all the Printers I have. But when I click on a record in the subform the data in the mainform doesn't change.
I have searched this forum and tried some coding. But everytime I try to run the code it says:"Compile error, method or data member not found."
An example of the code I used is the following. Can anybody tell me what I am doing wrong since I am fairly new to VB.
Thanx in advance,
Thijs Kromhout
The Netherlands.
The code:
Private Sub Form_Click()
Dim FormName As String, SyncCriteria As String
Dim f As Form, rs As Recordset
' form name to be syncronized
FormName = "frm-Orders" ' <make sure this is the exact name of your Orders form.
DoCmd.OpenForm FormName
'Define the form object and recordset object for the Orders form
Set f = Forms(FormName)
Set rs = f.RecordsetClone
' define the criteria used for the sync
SyncCriteria = "[Ordid]=" & Me![Ordid]
' find the corresponding record in the Parts table
rs.FindFirst SyncCriteria
f.Bookmark = rs.Bookmark
End Sub
I have a table named Printers. Now, I have created a form called Printers. On this form there is a subform show all the Printers I have. But when I click on a record in the subform the data in the mainform doesn't change.
I have searched this forum and tried some coding. But everytime I try to run the code it says:"Compile error, method or data member not found."
An example of the code I used is the following. Can anybody tell me what I am doing wrong since I am fairly new to VB.
Thanx in advance,
Thijs Kromhout
The Netherlands.
The code:
Private Sub Form_Click()
Dim FormName As String, SyncCriteria As String
Dim f As Form, rs As Recordset
' form name to be syncronized
FormName = "frm-Orders" ' <make sure this is the exact name of your Orders form.
DoCmd.OpenForm FormName
'Define the form object and recordset object for the Orders form
Set f = Forms(FormName)
Set rs = f.RecordsetClone
' define the criteria used for the sync
SyncCriteria = "[Ordid]=" & Me![Ordid]
' find the corresponding record in the Parts table
rs.FindFirst SyncCriteria
f.Bookmark = rs.Bookmark
End Sub