Ошибка access 2465

I keep getting a run time error ‘2465’ when running a query via VBA in Access.

Error: Microsoft Access can’t find the field ‘|1’ referred to in your expression

I can’t seem to find where this issue is occuring. Below is the VBA code that I’m currently using to requery a form.

Dim Test As String
Test = "*" & Combo161.Value

Dim strSQL As String
Dim strWhere As String
strWhere = (Chr(34) + Test + (Chr(34)))

'MsgBox (strWhere)

strSQL = "SELECT * FROM Test_Query WHERE TestID " & strWhere

'MsgBox (strSQL)
[Form_Test (subform)].RecordSource = strSQL
[Form_Test (subform)].Requery

The TestID had a field formatting of text, rather than a number. Does this matter at all?

Erik A's user avatar

Erik A

31.7k12 gold badges42 silver badges67 bronze badges

asked Feb 8, 2013 at 19:52

Muhnamana's user avatar

I have just fixed this error. I was referencing the subform’s source object, rather than its name given in the form properties.

answered Mar 9, 2016 at 23:20

rob's user avatar

0

I had the same error. What I missing was the double quotes around a string. This error is a bit misleading. Check the syntax etc and you will find the issue was related to comma or double quotes etc.

answered Sep 12, 2013 at 23:06

Tahir's user avatar

TahirTahir

212 bronze badges

Try:

Dim Test As String
Test = "*" & Combo161.Value

Dim strSQL As String
Dim strWhere As String
strWhere = (Chr(34) & Test & (Chr(34)))

'MsgBox (strWhere)

strSQL = "SELECT * FROM Test_Query WHERE TestID Like " & strWhere

'To test
'Debug.print strSQL

If this is a subform, then:

Me.[Form_Test (subform)].Form.RecordSource = strSQL
''Not needed when changing record source
''Me.[Form_Test (subform)].Form.Requery

You did not have an equals sign / Like and the concatenator in VBA is &, not +, using + can lead to problems with nulls, but in this case, I reckon the problen is the missing Like, that is

TestID Like "*something"

You can control the contents of a subform with a combo and a link field:

combo link

answered Feb 8, 2013 at 19:57

Fionnuala's user avatar

FionnualaFionnuala

90.4k7 gold badges114 silver badges152 bronze badges

8

I, too, had the same error and confirm it is a double double quote issue. You dim’ed

strWhere = (Chr(34) + Test + (Chr(34)))

which
produces ""*" & Combo161.Value"
resulting in the bad MS Access error message «can’t find …»

I would try variations on the double quotes. The following solved the issue for me:

"[Business Card ID]= " & Forms![Letterhead]![N/A] & " And [L2] Like '*Competency Questions'"

Note I used single quotes. I believe using single quotes versus double quotes is a mere issue of preference.

DecimalTurn's user avatar

DecimalTurn

3,3503 gold badges16 silver badges37 bronze badges

answered Jul 28 at 22:41

Jason T. Fleishman's user avatar

  • Remove From My Forums
  • Question

  • I have a form that is bound to two tables (Students and ServicePlans). There is a command button on the form to create a report showing data from the current records (i.e., the current service plan for the current student).

    I had to make some structural changes in the tables.  Prior to those changes, everything worked perfectly. However, the report does not gets its data directly from the tables but from a query that assembles the neccesary data in one place— and that
    query is still working properly. The report also still works when opened directly (except of course it shows all records, which defeats its purpose)

    When I press the command button I get the error «Run-time error ‘2465’ …can’t find the field ‘|1’ referred to in your expression»

    the code behind the button is:

    Private Sub CmdPrint_Click()
    Dim strWhere As String
    If Me.Dirty Then    'Save any edits.
            Me.Dirty = False
        End If
    
    If Me.NewRecord Then 'Check there is a record to print
            MsgBox "Select a record to print"
        Else
            strWhere = "[PlanID] = " & Me.[PlanID]
            DoCmd.Close
            DoCmd.OpenReport "Contract", acViewPreview, , strWhere
        End If
        
    End Sub

    I’m guessing » field ‘|1’ » must refer to [PlanID], since there is no other field in the code. However, the field does exist both in the form and the report (and the query).

    1. Is there some problem with the way I have referenced [PlanID]?
    2. If so, is there some obvious reason why it worked before and not now?
    3. If not, is there some other explanation for this error message?

    (I checked the error message in the help menu and found nothing. A google search revealed numerous threads, but all seemed to be either unresolved or not connected with this situation)

    Thanks!


    —nick

Answers

  • Nick —

    OK…we know the issue is with that line of code.  The reason your ideas didn’t work is that at this point in the code, you are just trying to build the WHERE clause BEFORE you open the report.  So it makes sense that it was bombing on that code
    you mentioned.

    The next question I would ask is — is it bombing in the code where I build strWhere or when I am opening the report.  One way to troubleshoot this is to try

    strWhere = «PlanID = » & 6  (obviously 6 would have to be a valid planID…use something valid from your tables.

    If the code doesn’t work here, then you know the issue is in the report — when it tries to set the filter, it cannot. So you need to troubleshoot there.   You might try

    strWhere = «Reports!Contact!PlanID=» & me.PlanID or something like that.

    If the code does work here, then you know that the issue is that your form code cannot find Me.PlanID on the form.  In that case you need to check on the form and make sure there is still a text box or somethign called PlanID and that you can get to
    it (can you even do MsgBox me.[planID] and get a value?  What if you remove the brackets? I hate brackets and avoid at all cost).

    Last q if this doesn’t work — what kind of structure change did you make? Did it affect PlanID at all?

    Hope this is helpful. check back and let us know what you find!


    Joy Eakins CDD, Inc.

    • Proposed as answer by

      Tuesday, May 1, 2012 5:50 PM

    • Marked as answer by
      Nick Vittum
      Tuesday, May 1, 2012 6:55 PM

  • Exactly which line generates the error?
    the line strWhere =
    «[PlanID] = « &
    Me.[PlanID] generates the error.

    Since the error is on that line, the problem has nothing to do with the report, or the query the report is based on. It has to do with the form.

    Maybe there is no field or control on the form named PlanID, or there is a control named PlanID but not bound to the PlanID field, yet there is a PlanID field in the form’s recordsource, or PlanID appears more than once in the select statement of the recordsource.

    • Marked as answer by
      Nick Vittum
      Tuesday, May 1, 2012 6:54 PM

I am currently working on a form to update fields in my database. The button (cmdFind) is meant to find the record for the part # (entered into text box txtFindPart), and then populate the data into In1-52 and out1-52. When I run it I get Run-time Error 2465 Microsoft Access can not find the field '|1' referred to in your expression.

Private Sub cmdFind_Click()
    Dim i As Integer
    i = 1
    If IsNull(txtFindPart) = False Then
        If Me.Recordset.NoMatch Then
            MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
            Me!txtFindPart = Null
        End If
        Do Until i = 53
            Me.Controls("in" & i) = DLookup("[In-Week " & i & "]", [Parts], "(([Parts].[Part #]) = '" & txtFindPart & "')")
            Me.Controls("out" & i) = DLookup("[Out-Week " & i & "]", [Parts], "(([Parts].[Part #]) = '" & txtFindPart & "')")
            i = i + 1
        Loop
    End If
End Sub

Any help would be greatly appreciated.

asked Jun 19, 2015 at 11:38

spriore's user avatar

4

I figured it out the problem was that the table Parts Was not open and it was causing the error. I just had to add a line to open the table and at the end close it.

DoCmd.OpenTable "Parts"
Dim i As Integer
i = 1
If IsNull(txtFindPart) = False Then
    If Me.Recordset.NoMatch Then
        MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
        Me!txtFindPart = Null
    End If
    Do Until i = 53
        Me.Controls("in" & i) = DLookup("[In-Week " & i & "]", "[Parts]", "(([Parts].[Part #]) = '" & txtFindPart & "')")
        Me.Controls("out" & i) = DLookup("[Out-Week " & i & "]", "[Parts]", "(([Parts].[Part #]) = '" & txtFindPart & "')")
        i = i + 1
    Loop
End If
DoCmd.Close , "Parts"

answered Jun 19, 2015 at 13:25

spriore's user avatar

spriorespriore

6033 gold badges10 silver badges17 bronze badges

0 / 0 / 0

Регистрация: 03.04.2018

Сообщений: 90

1

17.10.2018, 13:05. Показов 4237. Ответов 4


Студворк — интернет-сервис помощи студентам

Уважаемые форумчане, добрый вечер! Не могу решить проблему, подскажите, если сталкивались ! В форме «Главная_Пенсионеры», хочу чтобы при нажатие на человека, о нем выдавалась информация! Но пишет ошибку 2465, так как не силен в VBA, прошу помочь советами! Принскрин и базу прилагаю! Пароль:12345!Заранее благодарю всех кто откликнулся!

Миниатюры

Ошибка 2465 access
 



0



mobile

Эксперт MS Access

26792 / 14471 / 3192

Регистрация: 28.04.2012

Сообщений: 15,782

17.10.2018, 13:20

2

Лучший ответ Сообщение было отмечено Alex_Barcelona как решение

Решение

Закомментируйте или удалите строку

Visual Basic
1
'    Me!txtUnderLine.SetFocus

в процедуре cmdOpen_Click() формы Главная_Пенсионеры

Вложения

Тип файла: rar Рабочий вариант.rar (4.55 Мб, 7 просмотров)



1



431 / 239 / 86

Регистрация: 09.04.2018

Сообщений: 1,023

17.10.2018, 13:22

3

Лучший ответ Сообщение было отмечено Alex_Barcelona как решение

Решение

Alex_Barcelona, пробуйте.

поздно.



1



0 / 0 / 0

Регистрация: 03.04.2018

Сообщений: 90

17.10.2018, 13:48

 [ТС]

4

Kiriver, mobile, спасибо большое за помощь!)

Добавлено через 17 минут
Ребят, а не подскажите еще как сделать чтоб не на кнопку «Открыть» можно было только открывать информацию, но и просто по двойному клику на человека?!



0



mobile

Эксперт MS Access

26792 / 14471 / 3192

Регистрация: 28.04.2012

Сообщений: 15,782

17.10.2018, 14:03

5

Лучший ответ Сообщение было отмечено Alex_Barcelona как решение

Решение

На событии двойного клика поля ФИО копируем тот же код, что и на кнопке

Visual Basic
1
2
3
4
5
Private Sub ФИО_DblClick(Cancel As Integer)
    s = "Код=" & Me!Код
    Me.Visible = False
    DoCmd.OpenForm "Пенсионеры", , , s
End Sub

Вложения

Тип файла: rar Рабочий вариант.rar (4.55 Мб, 5 просмотров)



1



Icon Ex Error Number: Error 2465
Error Name: Access Error 2465
Error Description: Error 2465: Microsoft Access has encountered a problem and needs to close. We are sorry for the inconvenience.
Developer: Microsoft Corporation
Software: Microsoft Access
Applies to: Windows XP, Vista, 7, 8, 10, 11

Access Error 2465 Introduction

It is common for people to refer to Access Error 2465 as a runtime error (bug). Software developers such as Microsoft Corporation usually take Microsoft Access through multiple levels of debugging to weed out these bugs before being released to the public. Sadly, many errors can be missed, resulting in problems like those with error 2465.

Microsoft Access users can face an error message after execution the program such as «Access Error 2465». When this happens, end-users can inform Microsoft Corporation about the presence of Access Error 2465 bugs. The programming team can use this info to find and fix the issue (developing an update). In order to correct any documented errors (like error 2465) in the system, the developer can make use of a Microsoft Access update kit.

What Produces Runtime Error 2465?

A failure during the execution of Microsoft Access is generally when you will encounter Access Error 2465 as a runtime error. Here’s the three most common causes why error 2465 runtime errors happen:

Error 2465 Crash — Error number will trigger computer system lock-up, preventing you from using the program. This typically occurs when Microsoft Access cannot recognize that it is given an incorrect input, or is unaware of what it is supposed to produce.

Access Error 2465 Memory Leak — If there’s a memory leak in Microsoft Access, it may cause the OS to appear sluggish. A potential factor of the error is Microsoft Corporation’s code since the error prevents the program from ending.

Error 2465 Logic Error — You can experience a logic error when the program produces incorrect results even if the user specifies the right value. When the accuracy of Microsoft Corporation’s source code is low, it typically becomes a source of errors.

The root causes of Microsoft Corporation errors associated with Access Error 2465 include a missing or corrupt file, or in some cases, a past or present Microsoft Access-related malware infection. A large percentage of these file issues can be resolved with downloading and installing the latest version of your Microsoft Corporation file. Also, maintaining a clean and optimized Windows registry can help in preventing invalid Microsoft Corporation file path references, so we highly recommend running a registry scan on a regular basis.

Classic Access Error 2465 Problems

Common Access Error 2465 Problems Encountered with Microsoft Access:

  • «Access Error 2465 Program Error.»
  • «Access Error 2465 is not a valid Win32 application.»
  • «Sorry, Access Error 2465 encountered a problem.»
  • «Access Error 2465 can’t be located.»
  • «Access Error 2465 is missing.»
  • «Start-up error in application: Access Error 2465.»
  • «Access Error 2465 not working.»
  • «Access Error 2465 quit.»
  • «Faulting Application Path: Access Error 2465.»

Usually Access Error 2465 errors with Microsoft Access happen during startup or shutdown, while Access Error 2465 related programs are running, or rarely during the OS update sequence. It’s important to note when Access Error 2465 issues happen, as it helps troubleshoot Microsoft Access problems (and report to Microsoft Corporation).

Access Error 2465 Issue Origins

These Access Error 2465 troubles are created by missing or corrupt Access Error 2465 files, invalid Microsoft Access registry entries, or malicious software.

In particular, Access Error 2465 problems originate through:

  • Access Error 2465 entry invalid or corrupt.
  • Virus-contaminated and corrupted Access Error 2465.
  • Access Error 2465 mistakenly deleted or maliciously by software unrelated to the Microsoft Access application.
  • Another program conflicting with Access Error 2465 or another Microsoft Access shared reference.
  • Corrupted installation or download of Microsoft Access (Access Error 2465).

Product by Solvusoft

Download Now
WinThruster 2023 — Scan your PC for computer errors.

Compatible with Windows 11, 10, 8, 7, Vista, XP and 2000

Optional Offer for WinThruster by Solvusoft | EULA | Privacy Policy | Terms | Uninstall

Понравилась статья? Поделить с друзьями:
  • Ошибка abs ваз 2110
  • Ошибка acc lo кассовый аппарат
  • Ошибка abs меган 2
  • Ошибка abs subaru forester
  • Ошибка acc honda