I have an unbound main form (one side) with a subform (many side).
The main form has a textbox control on it whose visible property is set
to false. It's controlsource property is a reference to the ID field
on the subform (so the main form can tell which record on the subform
is selected).
Three command buttons allow the user to manipulate records that are
displayed in the subform (Add, Edit, Delete). After the user executes
on of these commands, a requery is needed on the subform. My attempts
to requery the subform are met with the 2467 error.
Here's the code under the "Add" button:
Private Sub cmdNewAdjustment_Click()
Set adj = New Adjustment
DoCmd.OpenForm "frmAdjustment", windowmode:=acDialog
With ajm
If Not adj Is Nothing Then
Set .Adjustment = adj
.AddAdjustment
End If
End With
Set adj = nothing
me.cldAdjustments.Form.Requery
End Sub
adj is a class I'm using as a Data Object. ajm is a class that handles
adding, etc. the adjustment to the database (not sure if any of this is
relevant). The last line of code is the one throwing the exception.
The name of the subform is correct. I've tried the alternate syntaxes
for referencing the control, with no success. Any ideas?
TIA,
Johnny