Full Version: RecordsetClone
UtterAccess Forums > Microsoft® Access > Access Forms
Access 2000
I have a form with a combo box link to a table, then I have a subform form link to another table. These two tables have the "recnum" as the common field. I need to synchronize the main form with the subform. when I select a recnum on the combobox then to show the proper data in the subform.
If anyone can give me some examples I will appreciate it.
Open the "main" form in Design View. On it place a subform control whose Source Object is the "sub" form. The Subform Wizard should then take over, follow the steps. Be sure that you set the linking fields correctly.
Thanks for your help, but I don't think is that easy.
Here is what I have:
A Commnad Botton
(Open a Form)
Under the form I have 3 pages
In the 3rd page I have a ComboBox
and two subforms
Oneed to synchronize the combo box to the subform. When I select a recnum on the combobox then to show the proper data in the subform.
There are a lot of ways to do this depending on how you have things set up.
You might try making the record source of your subform equal to a query that references the recnum in the main form. Something like:
SELECT * FROM Table1 WHERE Table1.recnum=[Forms]!MyMainForm.recnumCombo
And then add a Recalc in the combobox's AfterUpdate event:
Private Sub recnumCombo_AfterUpdate()
End Sub
Try using the ComboBox name as the LinkMasterFields of the SubformControls. Use appropriate/corresponding Field from the Subform datasource as the LinkChildFields.
Still not working, this is what I have so far!
The sub form is showing only the first record of the table.
Private Sub Form_Current()
On Error Resume Next
Dim IDrecnum As Integer
IDrecnum = Me.recnum
Dim SQLStr As String
SQLStr = "Select * from Tb_Temp_MBA_BO_Details WHERE recnum = " & IDrecnum
Forms![frm_MB_Automator]!frm_Temp_MBA_BO_Details.Form.RecordSource = SQLStr
End Sub
Private Sub cmb_MBA_BO_Rec_AfterUpdate()
Dim rst As Object
Dim strSearchName As String

mySql = " SELECT * FROM Tb_Temp_MBA_BO_Details WHERE Tb_Temp_MBA_BO_Details.recnum=[Forms]!frm_MB_Automator.cmb_MBA_BO_Rec"
mySql = mySql & " ORDER BY recnum"

Set rst = Me.RecordsetClone
If Me!cmb_MBA_BO_Rec <> "" Then
strSearchName = Str(Me!cmb_MBA_BO_Rec)
rst.Find "[recnum] = " & strSearchName
End If

Me.Bookmark = rst.Bookmark




End Sub
Have you tried the LinkMasterFields / LinkChildFields setting as per my previous post?
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.