UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> RecordsetClone    
 
   
jrmrcol
post Aug 4 2008, 02:03 PM
Post #1

New Member
Posts: 8



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.

Thanks!
Go to the top of the page
 
+
fkegley
post Aug 4 2008, 02:10 PM
Post #2

UtterAccess VIP
Posts: 23,583
From: Mississippi



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.
Go to the top of the page
 
+
jrmrcol
post Aug 4 2008, 02:41 PM
Post #3

New Member
Posts: 8



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

I need 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.
Go to the top of the page
 
+
merlicky
post Aug 4 2008, 04:38 PM
Post #4

UtterAccess Addict
Posts: 176
From: Kalamazoo



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()
Me.Recalc

End Sub
Go to the top of the page
 
+
vtd
post Aug 4 2008, 06:16 PM
Post #5

Retired Moderator
Posts: 19,667



Try using the ComboBox name as the LinkMasterFields of the SubformControls. Use appropriate/corresponding Field from the Subform datasource as the LinkChildFields.
Go to the top of the page
 
+
jrmrcol
post Aug 5 2008, 08:27 AM
Post #6

New Member
Posts: 8



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

rst.Close

Me.frm_Temp_MBA_BO_Details.Requery


Me.Recalc

End Sub
Go to the top of the page
 
+
vtd
post Aug 5 2008, 06:07 PM
Post #7

Retired Moderator
Posts: 19,667



Have you tried the LinkMasterFields / LinkChildFields setting as per my previous post?
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th May 2013 - 10:11 AM