I have a form/subform for inputting data into an ado table. The main form's recordset is a local table of Widgets and information about the widgets (WidgetID, WidgetName, size, color, location, etc). I am inputting test data (multiple tests per widget, all with unique dates) through the subform which is connected to an ADO recordset to a table called Tests. I have a combo box, findWidget, in the main form where the user can choose a WidgetID and it updates some info on the main form. I have also written VBA code to do the job of the parent/child relationship to change the recordset of the subform to only show the Tests that correspond to that WidgetID. However, There is a field for the WidgetID in the subform that I would like to be filled in automatically when i choose the WidgetID in the main form. This just worked before I applied the ADO recordset (i was using two local tables), and I set up a parent/child relationship. However, with ADO it seems parent/child doesn't work so I have to vba it. Here is the code I have tried, this is for when the subform loads:
Private Sub Form_Load()
Me.UCI = Forms!InputMainForm.findWidget
End Sub
The code executes with no errors, but the control in the subform is not updated. It is just blank upon loading the form. Maybe the code should be in the after update of the findWidget combo? I dont know. If I put it there I'm not really sure how to refer to the controls of the subform. Any ideas?
Thanks.
views:
440answers:
1
+1
A:
fixed it. I just set the default value of the control in the subform to be equal to the control from the main form. I also set the subform control to be locked so the user couldnt choose a different widget. this means that there is only one place in the whole interface for the user to choose a widget and that is in the main form (findWidget)
Matt
2009-11-11 15:48:18
Thanks for coming back with an answer.
Remou
2009-11-11 20:02:25