Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2465 1

Status
Not open for further replies.

blandis

Technical User
Jan 16, 2008
4
US
We are getting Run-time Error 2465
Microsoft Office Access can't find the field "|" referred to in your expression.

I can't find any |

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
 
Put square brackets around object names that have spaces or special characters, e.g.

[frm: Add/Edit Appts]

BTW, I would discourage using characters such as ":" and "/" in object names.

 
I realize I was not consist with renaming my forms and changed the item you referred to to
frm:_bfl_AddEdit Appts

I still get the error
 
Try taking the : (colon) out of the name, so just [frm_bfl_AddEdit Appts]

 
If you are using VBA, Try this to open your Form:
Code:
  DoCmd.OpenForm "frm_AddEdit Appts", , , , acFormAdd
This is assuming that your Form name is frm_AddEdits Appts; The square brackets primarily applies to SQL statements or macro statements. I seem to remember seeing them used in some code, but it was so long ago that I don't remember the context or how it was used. The above code is how I open all my forms programmatically
 
The name of the form is Add/Edits Appts
 
Which line of code is highlighted when in debug at the time the error raises ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Then try this:

Code:
  DoCmd.OpenForm "Add/Edits Appts"", , , , acFormAdd

In other words, leave off the "frm:" prefix off the form name being passed to the DoCmd.OpenForm method. See if that works
 
Just took a 2d look at your original posting; disregard my earlier postings; I believe you will find the trouble is with your SQL Where statement; instead of forming your Where statement on the fly, try declaring a string variable 1st and forming the statement with it, then passing the finalized variable to the openform method, as such:
Code:
dim SQLStr as String

...
  SQLStr = "[CltID] = " _
           & [ID] & " AND [TaxYear] = " _
           & [subfrm: 1040 Appointments].Form![Curr Tax Yr]
  DoCmd.OpenForm "frm:_bfl_AddEdit Appts", , , SQLStr
...

This allows you the benifit of seeing what is actually passed to the method, making for much easier debugging. You might be surprised at what you actually passed, and you can then adjust your SQL statement accordingly.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top