By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,573 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,573 IT Pros & Developers. It's quick & easy.

Subform Requery Issues - Error 2467

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Johnny Meredith wrote:
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


What is cldAdjustments? I usually reference subforms like
Forms!MainForm!SubForm.Form....
or
Me("SubForm").Form....
or
Dim strSubName As String
strSubName = "Test"
Me(strSubName).Form....
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.