Error 2465

B

blandis

We are receiving
Run-Time error 2465
Microsoft Office Access cant' find the field "|" referred to in your
expression

We have searched and find no such field and are stumped as to the
problem

code:

Private Sub EditAppt_Click()
'Opens the edit add/edit client appointment time and date

If IsNull([subfrm:1040 Appointments].Form![Curr Tax Yr]) Then
DoCmd.OpenForm "frm: Add/Edit Appts", , , , acFormAdd
Else
DoCmd.OpenForm "frm:_bfl_AddEdit Appts", , , "[CltID] = " &
[ID] & " AND [TaxYear] = " & [subfrm: 1040 Appointments].Form![Curr
Tax Yr]
End If

End Sub
 
J

Jeanette Cunningham

Hi,
this message is trying to tell you that Access can't find one of the fields
you have in your code.
Here are the fields/controls used in your code:
[Curr Tax Yr]
ID
subfrm: 1040 Appointments

you can use Debug.Print to check for missing fields
add the following 3 lines of code immediately after the line
'Opens the edit add/edit client appointment time and date

Private Sub EditAppt_Click()
'Opens the edit add/edit client appointment time and date
Debug.Print "[subfrm:1040 Appointments]: " & [subfrm:1040 Appointments]
Debug.Print "Curr Tax Yr: " & [subfrm:1040 Appointments].Form![Curr Tax
Yr]
Debug.Print "ID: " & ID
save the form, open in normal view and run the form
press Ctl + G to open the immediate window and see what Access has put for
subfrm:1040 Appointments, Curr Tax Yr, ID
any that have a blank after the colon are the ones that Access can't find
When Access can't find a field it gives the message can't find field "|"
where it is using "|" to represent the name of the thing it can't find.

Often there is an error finding controls on a subform
A subform is inside a subform control similar to the way a picture is inside
an image control.
The name of the subform control is often different from the name of the
subform.
To get the name of a control on a subform you need to go
Me.[subform control name].Form.[control name]

you should replace
[TaxYear] = " & [subfrm: 1040 Appointments].Form![Curr
Tax Yr]

with
[TaxYear] = " &Me. [name of subform control].Form![Curr
Tax Yr]

and
"[CltID] = " & [ID]

with
"[CltID] = " & Me!ID


Jeanette Cunningham
 
J

Jeanette Cunningham

<oops> there is an extra unwanted space in this bit where I have put **

you should replace
[TaxYear] = " & [subfrm: 1040 Appointments].Form![Curr
Tax Yr]

with
[TaxYear] = " &Me.**[name of subform control].Form![Curr
Tax Yr]

please remove the space between Me. and [name of subform
control].Form![Curr
Tax Yr]

Jeanette Cunningham


Jeanette Cunningham said:
Hi,
this message is trying to tell you that Access can't find one of the
fields you have in your code.
Here are the fields/controls used in your code:
[Curr Tax Yr]
ID
subfrm: 1040 Appointments

you can use Debug.Print to check for missing fields
add the following 3 lines of code immediately after the line
'Opens the edit add/edit client appointment time and date

Private Sub EditAppt_Click()
'Opens the edit add/edit client appointment time and date
Debug.Print "[subfrm:1040 Appointments]: " & [subfrm:1040 Appointments]
Debug.Print "Curr Tax Yr: " & [subfrm:1040 Appointments].Form![Curr Tax
Yr]
Debug.Print "ID: " & ID
save the form, open in normal view and run the form
press Ctl + G to open the immediate window and see what Access has put for
subfrm:1040 Appointments, Curr Tax Yr, ID
any that have a blank after the colon are the ones that Access can't find
When Access can't find a field it gives the message can't find field "|"
where it is using "|" to represent the name of the thing it can't find.

Often there is an error finding controls on a subform
A subform is inside a subform control similar to the way a picture is
inside an image control.
The name of the subform control is often different from the name of the
subform.
To get the name of a control on a subform you need to go
Me.[subform control name].Form.[control name]

you should replace
[TaxYear] = " & [subfrm: 1040 Appointments].Form![Curr
Tax Yr]

with
[TaxYear] = " &Me. [name of subform control].Form![Curr
Tax Yr]

and
"[CltID] = " & [ID]

with
"[CltID] = " & Me!ID


Jeanette Cunningham


We are receiving
Run-Time error 2465
Microsoft Office Access cant' find the field "|" referred to in your
expression

We have searched and find no such field and are stumped as to the
problem

code:

Private Sub EditAppt_Click()
'Opens the edit add/edit client appointment time and date

If IsNull([subfrm:1040 Appointments].Form![Curr Tax Yr]) Then
DoCmd.OpenForm "frm: Add/Edit Appts", , , , acFormAdd
Else
DoCmd.OpenForm "frm:_bfl_AddEdit Appts", , , "[CltID] = " &
[ID] & " AND [TaxYear] = " & [subfrm: 1040 Appointments].Form![Curr
Tax Yr]
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top