B
BBC via AccessMonster.com
I have a mainform that displays detailed records for a particular selected
date (one at a time of course). I have a subform (datasheet view) that
displays all the records available (but not all the detail) for the
particular date. The table is bound to the mainform. The subform was
created with the Wizard and connects the same table to the maionform via the
"Date" field.
I want to be able to click on the subfrom record to be viewed and have the
main form then display that detail record. It would be OK to leave the focus
on the subform or switch the focus to the main form (or a control on it)
after the subform record is selected.
I currently am using the following code in the subform's "CURRENT" event to
change the primary key to that of the subfrom (thus switching to that record).
The following code in the subform's current event has been tried;
Private Sub Form_Current()
If Nz(Me.ID, 0) > 0 Then
Me.Parent.ID = Me.ID
Me.Parent.Requery
End If
End Sub
I get a "Can't assign a value to this object" on the Me.Parent.ID=Me.ID
line.
Me.ID has a correct value in it.
I've also tried
[forms]![mainformname]![ID]=Me.ID
Me.Parent!ID=Me.ID
... etc...
Any ideas why this isn't working or Is there another approach I should be
using for this?
thanks
date (one at a time of course). I have a subform (datasheet view) that
displays all the records available (but not all the detail) for the
particular date. The table is bound to the mainform. The subform was
created with the Wizard and connects the same table to the maionform via the
"Date" field.
I want to be able to click on the subfrom record to be viewed and have the
main form then display that detail record. It would be OK to leave the focus
on the subform or switch the focus to the main form (or a control on it)
after the subform record is selected.
I currently am using the following code in the subform's "CURRENT" event to
change the primary key to that of the subfrom (thus switching to that record).
The following code in the subform's current event has been tried;
Private Sub Form_Current()
If Nz(Me.ID, 0) > 0 Then
Me.Parent.ID = Me.ID
Me.Parent.Requery
End If
End Sub
I get a "Can't assign a value to this object" on the Me.Parent.ID=Me.ID
line.
Me.ID has a correct value in it.
I've also tried
[forms]![mainformname]![ID]=Me.ID
Me.Parent!ID=Me.ID
... etc...
Any ideas why this isn't working or Is there another approach I should be
using for this?
thanks