Ошибка 2482 access

Icon Ex Номер ошибки: Ошибка 2482
Название ошибки: Microsoft Office Access can’t find the name ‘|’ you entered in the expression
Описание ошибки: Microsoft Office Access can’t find the name ‘|’ you entered in the expression.@You may have specified a control that wasn’t on the current object without specifying the correct form or report context.@To refer to a control on another form or report, prece
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Access
Относится к: Windows XP, Vista, 7, 8, 10, 11

Определение «Microsoft Office Access can’t find the name ‘|’ you entered in the expression»

Как правило, специалисты по ПК называют «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» как тип «ошибки времени выполнения». Разработчики Microsoft Corporation обычно оценивают Microsoft Access с помощью серии модулей для удаления ошибок в соответствии с отраслевыми стандартами. Ошибки, такие как ошибка 2482, иногда удаляются из отчетов, оставляя проблему остается нерешенной в программном обеспечении.

Некоторые люди могут столкнуться с сообщением «Microsoft Office Access can’t find the name ‘|’ you entered in the expression.@You may have specified a control that wasn’t on the current object without specifying the correct form or report context.@To refer to a control on another form or report, prece» во время работы программного обеспечения. Если возникает ошибка 2482, разработчикам будет сообщено об этой проблеме через уведомления об ошибках, которые встроены в Microsoft Access. Затем Microsoft Corporation будет иметь знания, чтобы исследовать, как и где устранить проблему. Поэтому, когда вы сталкиваетесь с запросом на обновление Microsoft Access, это обычно связано с тем, что это решение для исправления ошибки 2482 и других ошибок.

Почему возникает ошибка времени выполнения 2482?

Сбой устройства или Microsoft Access обычно может проявляться с «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» в качестве проблемы во время выполнения. Мы можем определить происхождение ошибок ошибки 2482 во время выполнения следующим образом:

Ошибка 2482 Crash — Номер ошибки вызовет блокировка системы компьютера, препятствуя использованию программы. Обычно это происходит, когда Microsoft Access не может обработать данные в удовлетворительной форме и поэтому не может получить ожидаемый результат.

Утечка памяти «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» — ошибка 2482 утечка памяти приводит к тому, что Microsoft Access использует все больше памяти, что делает ваш компьютер запуск медленнее и замедляет вывод системы. Возможные провокации включают отсутствие девыделения памяти и ссылку на плохой код, такой как бесконечные циклы.

Ошибка 2482 Logic Error — «логическая ошибка», как говорят, генерируется, когда программное обеспечение получает правильный ввод, но генерирует неверный вывод. Это может произойти, когда исходный код Microsoft Corporation имеет уязвимость в отношении передачи данных.

Как правило, такие Microsoft Corporation ошибки возникают из-за повреждённых или отсутствующих файлов Microsoft Office Access can’t find the name ‘|’ you entered in the expression, а иногда — в результате заражения вредоносным ПО в настоящем или прошлом, что оказало влияние на Microsoft Access. Обычно, установка новой версии файла Microsoft Corporation позволяет устранить проблему, из-за которой возникает ошибка. Запуск сканирования реестра после замены файла, из-за которого возникает проблема, позволит очистить все недействительные файлы Microsoft Office Access can’t find the name ‘|’ you entered in the expression, расширения файлов или другие ссылки на файлы, которые могли быть повреждены в результате заражения вредоносным ПО.

Классические проблемы Microsoft Office Access can’t find the name ‘|’ you entered in the expression

Microsoft Office Access can’t find the name ‘|’ you entered in the expression Проблемы, связанные с Microsoft Access:

  • «Ошибка Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Microsoft Office Access can’t find the name ‘|’ you entered in the expression не является приложением Win32.»
  • «Возникла ошибка в приложении Microsoft Office Access can’t find the name ‘|’ you entered in the expression. Приложение будет закрыто. Приносим извинения за неудобства.»
  • «К сожалению, мы не можем найти Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Microsoft Office Access can’t find the name ‘|’ you entered in the expression не найден.»
  • «Ошибка запуска в приложении: Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Файл Microsoft Office Access can’t find the name ‘|’ you entered in the expression не запущен.»
  • «Отказ Microsoft Office Access can’t find the name ‘|’ you entered in the expression.»
  • «Неверный путь к программе: Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «

Обычно ошибки Microsoft Office Access can’t find the name ‘|’ you entered in the expression с Microsoft Access возникают во время запуска или завершения работы, в то время как программы, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression, выполняются, или редко во время последовательности обновления ОС. Запись ошибок Microsoft Office Access can’t find the name ‘|’ you entered in the expression внутри Microsoft Access имеет решающее значение для обнаружения неисправностей электронной Windows и ретрансляции обратно в Microsoft Corporation для параметров ремонта.

Источник ошибок Microsoft Office Access can’t find the name ‘|’ you entered in the expression

Проблемы Microsoft Office Access can’t find the name ‘|’ you entered in the expression вызваны поврежденным или отсутствующим Microsoft Office Access can’t find the name ‘|’ you entered in the expression, недопустимыми ключами реестра, связанными с Microsoft Access, или вредоносным ПО.

В основном, осложнения Microsoft Office Access can’t find the name ‘|’ you entered in the expression связаны с:

  • Поврежденные ключи реестра Windows, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression / Microsoft Access.
  • Файл Microsoft Office Access can’t find the name ‘|’ you entered in the expression поврежден от вирусной инфекции.
  • Другая программа злонамеренно или по ошибке удалила файлы, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression.
  • Microsoft Office Access can’t find the name ‘|’ you entered in the expression конфликтует с другой программой (общим файлом).
  • Microsoft Access (Microsoft Office Access can’t find the name ‘|’ you entered in the expression) поврежден во время загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2023 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

If error message seems very odd, then it can usually be caused by broken references or corrupted file.

If Your application has additional references to other applications like Word or Excel, then it makes distributing to other computers more complicated. I suggest the solution to remove all additional references prior distributing to other computer.

Create the module that does contain minimum functionality and includes a procedure that is called as first action in Autoexec macro. This procedure will add all required procedures on program start up if those are available.

If some reference can not be added, then the application continues to work until some procedure from module that uses not available reference is used. This means that if only one user is using some advanced Excel reporting functionality then other user without Excel can continue working until they call some procedure from module requiring Excel reference.

The sample code for adding references programatically can be found here http://www.tek-tips.com/viewthread.cfm?qid=903662

Note: By painful experience the .IsBroken property of the reference does not always work as expected.

For more complex cases special VBA library for handling references can be found here: http://afrablox.com/Default.aspx?tabid=406&language=en-US
I had to distribute complex Microsoft Access application with more than 15 references to other libraries. As a result of long and painful experimenting the special references handling library was born. That suits for cases when mdb or accdb format can be used, because mde and accde files do not allow adding references dynamically.

Icon Ex Номер ошибки: Ошибка 2482
Название ошибки: Microsoft Office Access can’t find the name ‘|’ you entered in the expression
Описание ошибки: Microsoft Office Access can’t find the name ‘|’ you entered in the expression.@You may have specified a control that wasn’t on the current object without specifying the correct form or report context.@To refer to a control on another form or report, prece
Разработчик: Microsoft Corporation
Программное обеспечение: Microsoft Access
Относится к: Windows XP, Vista, 7, 8, 10, 11

Определение «Microsoft Office Access can’t find the name ‘|’ you entered in the expression»

Как правило, специалисты по ПК называют «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» как тип «ошибки времени выполнения». Разработчики Microsoft Corporation обычно оценивают Microsoft Access с помощью серии модулей для удаления ошибок в соответствии с отраслевыми стандартами. Ошибки, такие как ошибка 2482, иногда удаляются из отчетов, оставляя проблему остается нерешенной в программном обеспечении.

Некоторые люди могут столкнуться с сообщением «Microsoft Office Access can’t find the name ‘|’ you entered in the expression.@You may have specified a control that wasn’t on the current object without specifying the correct form or report context.@To refer to a control on another form or report, prece» во время работы программного обеспечения. Если возникает ошибка 2482, разработчикам будет сообщено об этой проблеме через уведомления об ошибках, которые встроены в Microsoft Access. Затем Microsoft Corporation будет иметь знания, чтобы исследовать, как и где устранить проблему. Поэтому, когда вы сталкиваетесь с запросом на обновление Microsoft Access, это обычно связано с тем, что это решение для исправления ошибки 2482 и других ошибок.

Сбой устройства или Microsoft Access обычно может проявляться с «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» в качестве проблемы во время выполнения. Мы можем определить происхождение ошибок ошибки 2482 во время выполнения следующим образом:

Ошибка 2482 Crash — Номер ошибки вызовет блокировка системы компьютера, препятствуя использованию программы. Обычно это происходит, когда Microsoft Access не может обработать данные в удовлетворительной форме и поэтому не может получить ожидаемый результат.

Утечка памяти «Microsoft Office Access can’t find the name ‘|’ you entered in the expression» — ошибка 2482 утечка памяти приводит к тому, что Microsoft Access использует все больше памяти, что делает ваш компьютер запуск медленнее и замедляет вывод системы. Возможные провокации включают отсутствие девыделения памяти и ссылку на плохой код, такой как бесконечные циклы.

Ошибка 2482 Logic Error — «логическая ошибка», как говорят, генерируется, когда программное обеспечение получает правильный ввод, но генерирует неверный вывод. Это может произойти, когда исходный код Microsoft Corporation имеет уязвимость в отношении передачи данных.

Как правило, такие Microsoft Corporation ошибки возникают из-за повреждённых или отсутствующих файлов Microsoft Office Access can’t find the name ‘|’ you entered in the expression, а иногда — в результате заражения вредоносным ПО в настоящем или прошлом, что оказало влияние на Microsoft Access. Обычно, установка новой версии файла Microsoft Corporation позволяет устранить проблему, из-за которой возникает ошибка. Запуск сканирования реестра после замены файла, из-за которого возникает проблема, позволит очистить все недействительные файлы Microsoft Office Access can’t find the name ‘|’ you entered in the expression, расширения файлов или другие ссылки на файлы, которые могли быть повреждены в результате заражения вредоносным ПО.

Классические проблемы Microsoft Office Access can’t find the name ‘|’ you entered in the expression

Microsoft Office Access can’t find the name ‘|’ you entered in the expression Проблемы, связанные с Microsoft Access:

  • «Ошибка Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Microsoft Office Access can’t find the name ‘|’ you entered in the expression не является приложением Win32.»
  • «Возникла ошибка в приложении Microsoft Office Access can’t find the name ‘|’ you entered in the expression. Приложение будет закрыто. Приносим извинения за неудобства.»
  • «К сожалению, мы не можем найти Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Microsoft Office Access can’t find the name ‘|’ you entered in the expression не найден.»
  • «Ошибка запуска в приложении: Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «
  • «Файл Microsoft Office Access can’t find the name ‘|’ you entered in the expression не запущен.»
  • «Отказ Microsoft Office Access can’t find the name ‘|’ you entered in the expression.»
  • «Неверный путь к программе: Microsoft Office Access can’t find the name ‘|’ you entered in the expression. «

Обычно ошибки Microsoft Office Access can’t find the name ‘|’ you entered in the expression с Microsoft Access возникают во время запуска или завершения работы, в то время как программы, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression, выполняются, или редко во время последовательности обновления ОС. Запись ошибок Microsoft Office Access can’t find the name ‘|’ you entered in the expression внутри Microsoft Access имеет решающее значение для обнаружения неисправностей электронной Windows и ретрансляции обратно в Microsoft Corporation для параметров ремонта.

Источник ошибок Microsoft Office Access can’t find the name ‘|’ you entered in the expression

Проблемы Microsoft Office Access can’t find the name ‘|’ you entered in the expression вызваны поврежденным или отсутствующим Microsoft Office Access can’t find the name ‘|’ you entered in the expression, недопустимыми ключами реестра, связанными с Microsoft Access, или вредоносным ПО.

В основном, осложнения Microsoft Office Access can’t find the name ‘|’ you entered in the expression связаны с:

  • Поврежденные ключи реестра Windows, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression / Microsoft Access.
  • Файл Microsoft Office Access can’t find the name ‘|’ you entered in the expression поврежден от вирусной инфекции.
  • Другая программа злонамеренно или по ошибке удалила файлы, связанные с Microsoft Office Access can’t find the name ‘|’ you entered in the expression.
  • Microsoft Office Access can’t find the name ‘|’ you entered in the expression конфликтует с другой программой (общим файлом).
  • Microsoft Access (Microsoft Office Access can’t find the name ‘|’ you entered in the expression) поврежден во время загрузки или установки.

Продукт Solvusoft

Загрузка
WinThruster 2023 — Проверьте свой компьютер на наличие ошибок.

Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11

Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление

If error message seems very odd, then it can usually be caused by broken references or corrupted file.

If Your application has additional references to other applications like Word or Excel, then it makes distributing to other computers more complicated. I suggest the solution to remove all additional references prior distributing to other computer.

Create the module that does contain minimum functionality and includes a procedure that is called as first action in Autoexec macro. This procedure will add all required procedures on program start up if those are available.

If some reference can not be added, then the application continues to work until some procedure from module that uses not available reference is used. This means that if only one user is using some advanced Excel reporting functionality then other user without Excel can continue working until they call some procedure from module requiring Excel reference.

The sample code for adding references programatically can be found here http://www.tek-tips.com/viewthread.cfm?qid=903662

Note: By painful experience the .IsBroken property of the reference does not always work as expected.

For more complex cases special VBA library for handling references can be found here: http://afrablox.com/Default.aspx?tabid=406&language=en-US
I had to distribute complex Microsoft Access application with more than 15 references to other libraries. As a result of long and painful experimenting the special references handling library was born. That suits for cases when mdb or accdb format can be used, because mde and accde files do not allow adding references dynamically.

I have an Access VB module that, when I try to run it, reports «Run-time error ‘2482’: Microsoft Office Access can’t find the name ‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the line: par.Value = Eval(par.Name), which I realize means that the problem is somewhere before that line.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef         ‘add these two
Dim par As Parameter

  Set dbs = CurrentDb
    With CurrentDb
      Set qdf = dbs.QueryDefs(«MyQuery»)    ‘add this

              For iLoop = 1 To 5
          For jLoop = 1 To 18
            For kLoop = 1 To 21
              Set rsVarType = dbs.OpenRecordset(«Select VarType From tblCharacter Where ID = » & iLoop)
              strVarType = rsVarType!VarType ‘ Set the first Variable Type string
              Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From tblCharacter Where ID = » & jLoop)
              strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var string
              Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From tblCharacter Where ID = » & jLoop)
              strCllgFice = rsCllgFice!CllgFice ‘ Set the first College Fice string
              Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr From tblCharacter Where ID = » & jLoop)
              strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first College Enrollment Year string
              Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From tblCharacter Where ID = » & kLoop)
              StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
              strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» & strVarType & «-02May-MLM]»
              strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & » = [LSAYFice-» & strVarType
              strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.» & strVarType & strCllgVar
              strSQL = strSQL & » = [LSAYFice-» & strVarType & «-02May-MLM].[» & strVarType & StrFiceYr & «]»
              strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType & strCllgVar & «) Is Null)»
              strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» & strCllgEnrollYr & «)=» & kLoop & «));»
      qdf.SQL = strSQL      ‘this stuffs your SQL string into the query definition
                            ‘the following resolves the VB parameter so that Access can understand it
              For Each par In qdf.Parameters
                par.Value = Eval(par.Name)
              Next par

      qdf.Execute   ‘this should run the query
            Next kLoop
          Next jLoop
        Next iLoop

    End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType    =    affil
CllgVar    =    31B
CllgFice =    R30A1
CllEnrollYr =    R31B
FiceYr =    06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access Help came up with a screen about With Statements. Should I have nested With statements? How would I fit them in? (Have I done something to change my object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so that I can check what the module is actually producing? (something like a DOS echo function? — as you can tell, I’m fairly new at this. I’ve gotten as far as I have with this script with the help of people in the Access listserve)

Thank you in advance.

Marian Mitchell

I have an Access VB module that, when I try to run it, reports «Run-time error ‘2482’: Microsoft Office Access can’t find the name ‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the line: par.Value = Eval(par.Name), which I realize means that the problem is somewhere before that line.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef         ‘add these two
Dim par As Parameter

  Set dbs = CurrentDb
    With CurrentDb
      Set qdf = dbs.QueryDefs(«MyQuery»)    ‘add this

              For iLoop = 1 To 5
          For jLoop = 1 To 18
            For kLoop = 1 To 21
              Set rsVarType = dbs.OpenRecordset(«Select VarType From tblCharacter Where ID = » & iLoop)
              strVarType = rsVarType!VarType ‘ Set the first Variable Type string
              Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From tblCharacter Where ID = » & jLoop)
              strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var string
              Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From tblCharacter Where ID = » & jLoop)
              strCllgFice = rsCllgFice!CllgFice ‘ Set the first College Fice string
              Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr From tblCharacter Where ID = » & jLoop)
              strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first College Enrollment Year string
              Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From tblCharacter Where ID = » & kLoop)
              StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
              strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» & strVarType & «-02May-MLM]»
              strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & » = [LSAYFice-» & strVarType
              strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.» & strVarType & strCllgVar
              strSQL = strSQL & » = [LSAYFice-» & strVarType & «-02May-MLM].[» & strVarType & StrFiceYr & «]»
              strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType & strCllgVar & «) Is Null)»
              strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» & strCllgEnrollYr & «)=» & kLoop & «));»
      qdf.SQL = strSQL      ‘this stuffs your SQL string into the query definition
                            ‘the following resolves the VB parameter so that Access can understand it
              For Each par In qdf.Parameters
                par.Value = Eval(par.Name)
              Next par

      qdf.Execute   ‘this should run the query
            Next kLoop
          Next jLoop
        Next iLoop

    End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType    =    affil
CllgVar    =    31B
CllgFice =    R30A1
CllEnrollYr =    R31B
FiceYr =    06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access Help came up with a screen about With Statements. Should I have nested With statements? How would I fit them in? (Have I done something to change my object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so that I can check what the module is actually producing? (something like a DOS echo function? — as you can tell, I’m fairly new at this. I’ve gotten as far as I have with this script with the help of people in the Access listserve)

Thank you in advance.

Marian Mitchell

Если сообщение об ошибке кажется очень странным, то оно может быть вызвано неверными ссылками или поврежденным файлом.

Если ваше приложение имеет дополнительные ссылки на другие приложения, такие как Word или Excel, то это усложняет распространение на другие компьютеры. Я предлагаю решение удалить все дополнительные ссылки перед распространением на другой компьютер.

Создайте модуль, который содержит минимальные функциональные возможности и включает процедуру, которая вызывается как первое действие в макросе Autoexec. Эта процедура добавит все необходимые процедуры при запуске программы, если таковые имеются.

Если какая-либо ссылка не может быть добавлена, то приложение продолжает работать до тех пор, пока не будет использована некоторая процедура из модуля, который использует недоступную ссылку. Это означает, что если только один пользователь использует некоторые расширенные функции отчетов Excel, то другой пользователь без Excel может продолжать работать, пока не вызовет какую-то процедуру из модуля, требующего ссылки на Excel.

Пример кода для программного добавления ссылок можно найти здесь http://www.tek-tips.com/viewthread.cfm?qid=903662

Примечание. Из-за мучительного опыта свойство ссылки.IsBroken не всегда работает должным образом.

Для более сложных случаев специальную библиотеку VBA для обработки ссылок можно найти здесь: http://afrablox.com/Default.aspx?tabid=406&language=en-US Мне пришлось распространять сложное приложение Microsoft Access с более чем 15 ссылками на другие библиотеки., В результате долгих и мучительных экспериментов родилась специальная библиотека для обработки ссылок. Это подходит для случаев, когда можно использовать формат mdb или accdb, поскольку файлы mde и accde не позволяют динамически добавлять ссылки.

  • #1

Hello,

I’ve got a workaround for my problem, but I’m trying to learn about what it is that I’m missing. Here’s what I ended up with, and it works just fine:

Code:

Private Sub CheckAndProceed(bytRequest As Byte)

...Stuff happens to get the the select statement...

Select Case bytPreCheck
    Case 1
        strMessage = "You are about to request payment:"
    Case 2
        strMessage = "You are about to request PRE-PAYMENT:"
    Case 11
        strMessage = "You are about to update:"
    Case 12
        strMessage = "You are about to update for PRE-PAYMENT:"
End Select

strMessage = strMessage & vbCrLf & vbCrLf & "  " & Chr(149) & intCount & " Payment Detail Record(s)." _
& vbCrLf & "  " & Chr(149) & "Totaling " & strCurrency & " " & Format(sngSum, "Standard") _
& vbCrLf & vbCrLf & "Would you like to proceed?"

If MsgBox(strMessage, vbYesNo, "UPDATE RECORDS?") = vbYes Then
    Select Case bytPreCheck
        Case 1
            RequestReimbEmail Me.txtSubjectID, False
        Case 2
            RequestReimbEmail Me.txtSubjectID, True
        Case 11
            MarkReadyToProcess intCount, Me.txtSubjectID, False
        Case 12
            MarkReadyToProcess intCount, Me.txtSubjectID, True
    End Select
End If

End sub

What I’d hoped to do was:

Code:

Private Sub CheckAndProceed(bytRequest As Byte)

...Same stuff happening...

Select Case bytPreCheck
    Case 1
        strMessage = "You are about to request payment:"
        strFunction = "RequestReimbEmail Me.txtSubjectID, False"
    Case 2
        strMessage = "You are about to request PRE-PAYMENT:"
        strFunction = "RequestReimbEmail Me.txtSubjectID, True"
    Case 11
        strMessage = "You are about to update:"
        strFunction = "MarkReadyToProcess intCount, Me.txtSubjectID, False"
    Case 12
        strMessage = "You are about to update for PRE-PAYMENT:"
        strFunction = "MarkReadyToProcess intCount, Me.txtSubjectID, True"
End Select

strMessage = strMessage & vbCrLf & vbCrLf & "  " & Chr(149) & intCount & " Payment Detail Record(s)." _
& vbCrLf & "  " & Chr(149) & "Totaling " & strCurrency & " " & Format(sngSum, "Standard") _
& vbCrLf & vbCrLf & "Would you like to proceed?"

If MsgBox(strMessage, vbYesNo, "UPDATE RECORDS?") = vbYes Then Eval (strFunction)

End Sub

But when I do it this way, I get «Run-time error ‘2482’: [ProgramName] cannot find the name ‘RequestReimbEmail’ you entered in the expression.»

If you have the time, I’d love to learn why the latter code won’t execute as I’d expected. Thanks.

  • #2

But you didn’t post the code for RequestReimbEmail? How could anyone answer this without it?

  • #3

If you pass a function name to Eval, you must include () after the function name. Maybe

«MarkReadyToProcess() intCount, Me.txtSubjectID, False»

  • #4

But you didn’t post the code for RequestReimbEmail? How could anyone answer this without it?

Sorry, I get the same «cannot find» for the MarkReadyToProcess options. My assumption was that the issue is with how I’m using Eval, not the actual subs that are being called, as they work if I don’t use the Eval() method. If the issue was the actual subs, wouldn’t they fail when called directly?

It also occurred to me that the subs are on a Report, not a form.

Code:

Private Sub RequestReimbEmail(lngSubjectID As Long, blnFuture As Boolean)
...creates and sends an email in Outlook...
End Sub

Private Sub MarkReadyToProcess(intTravelItemCount As Integer, lngSubjectID As Long, blnFuture As Boolean)
...just edits the records...
End Sub

Again, for of these execute when not trying to use the Eval method.

  • #5

Consider:

strFunction = «MarkReadyToProcess(» & intCount & «, » & Me.txtSubjectID & «,True}»

Must be a Function not a Sub procedure.

Last edited: Aug 27, 2020

  • #6

Consider:

strFunction = «MarkReadyToProcess(» & intCount & «, » & Me.txtSubjectID & «,True}»

Must be a Function not a Sub procedure.

Yep. When I tried it without making it a function I got a Run-time error 2425: The expression you entered has a function…» So I changed it to a function and… still no joy. Same 2425 Error.

The call code is:

Code:

    Eval ("RequestReimbEmail(" & Me.txtSubjectID & "," & True & ")")

The function is now:

Code:

Public Function RequestReimbEmail(lngSubjectID As Long, blnFuture As Boolean)
...does the same stuff...
End Function
  • #7

Works for me but my Function is in general module.

If you want to provide db for analysis, follow instructions at bottom of my post.

  • #8

Works for me but my Function is in general module.

If you want to provide db for analysis, follow instructions at bottom of my post.

Thank you for your help. I got it to work by doing the following:

  1. I moved the subroutines into their own module (out of the report’s processes) and converted them into functions.
  2. I removed the function variables from the all-inclusive string and put them in the suggested concatenated form.
  3. I do not need to run the function on the right side of an equation.

So I guess the answers for me are that Eval() needs to call a function and not to put functions in a report process. I cannot say that other than Eval() needing a function that I have the definitive answer on why it didn’t work when that function was in the report’s modules rather than as a stand-alone module.

Last edited: Aug 27, 2020

The_Doc_Man

  • #9

Sonnydl said:

I’d love to learn why the latter code won’t execute as I’d expected.

Eval evaluates an expression that returns a value. It can evaluate a function if it can see the function. Your Post #8, step 1, made the function visible (put it in Public scope) so that Eval could find it using the «standard» expression evaluator. What Eval does, in brief, is takes the right-hand side of an assignment statement and evaluates it. But the acid test of whether it would work or not is whether the following works:

Code:

Dim A as Variant
...
    A = {expression to be evaluated)

If the above works, then an Eval call for that expression that follows the «=» should also work providing you get any required quotes properly managed. However, Eval is concerned about where it is executing, and it is NOT where you might have thought. That is why you had to move things around to be visible.

  • #10

and put them in the suggested concatenated form.

visibility of the function aside, what does that mean? Does it mean you incorporated the parentheses (and I suppose the parameters) as mentioned in my post and at ms access site:

Note: If you are passing the name of a function to the Eval function, you must include parentheses after the name of the function in the stringexpr argument. For example:
‘ ShowNames is user-defined function.
Debug.Print Eval(«ShowNames()»)

Debug.Print Eval(«StrComp(«»Joe»»,»»joe»», 1)»)

or something else?
Thanks.

Marian M.

  • #1

I have written an Access VB module that, when I try to run it, reports
«Run-time error ‘2482’: Microsoft Office Access can’t find the name
‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the line:
par.Value = Eval(par.Name), which I realize means that the problem is
somewhere before that line. But, the table =does= exist.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef ‘add these two
Dim par As Parameter

Set dbs = CurrentDb
With CurrentDb
Set qdf = dbs.QueryDefs(«MyQuery») ‘add this

For iLoop = 1 To 5
For jLoop = 1 To 18
For kLoop = 1 To 21
Set rsVarType = dbs.OpenRecordset(«Select VarType From
tblCharacter Where ID = » & iLoop)
strVarType = rsVarType!VarType ‘ Set the first Variable Type
string
Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From
tblCharacter Where ID = » & jLoop)
strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var
string
Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From
tblCharacter Where ID = » & jLoop)
strCllgFice = rsCllgFice!CllgFice ‘ Set the first College Fice
string
Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr
From tblCharacter Where ID = » & jLoop)
strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first
College Enrollment Year string
Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From
tblCharacter Where ID = » & kLoop)
StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» &
strVarType & «-02May-MLM]»
strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & » =
[LSAYFice-» & strVarType
strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.»
& strVarType & strCllgVar
strSQL = strSQL & » = [LSAYFice-» & strVarType &
«-02May-MLM].[» & strVarType & StrFiceYr & «]»
strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType
& strCllgVar & «) Is Null)»
strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» &
strCllgEnrollYr & «)=» & kLoop & «));»
qdf.SQL = strSQL ‘this stuffs your SQL string into the query
definition
‘the following resolves the VB parameter so that
Access can understand it
For Each par In qdf.Parameters
par.Value = Eval(par.Name)
Next par

qdf.Execute ‘this should run the query
Next kLoop
Next jLoop
Next iLoop

End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType = affil
CllgVar = 31B
CllgFice = R30A1
CllEnrollYr = R31B
FiceYr = 06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON
LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET
LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND
((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access
Help came up with a screen about With Statements. Should I have nested With
statements? How would I fit them in? (Have I done something to change my
object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so
that I can check what the module is actually producing? (something like a DOS
echo function? — as you can tell, I’m fairly new at this. I’ve gotten as far
as I have with this script with the help of people in the Access listserve &
MS discussion groups)

Thank you in advance.

Marian Mitchell

Advertisements

Douglas J. Steele

  • #2

What’s actually in strSQL when the error occurs?


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Marian M. said:

I have written an Access VB module that, when I try to run it, reports
«Run-time error ‘2482’: Microsoft Office Access can’t find the name
‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the
line:
par.Value = Eval(par.Name), which I realize means that the problem is
somewhere before that line. But, the table =does= exist.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As
Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef ‘add these two
Dim par As Parameter

Set dbs = CurrentDb
With CurrentDb
Set qdf = dbs.QueryDefs(«MyQuery») ‘add this

For iLoop = 1 To 5
For jLoop = 1 To 18
For kLoop = 1 To 21
Set rsVarType = dbs.OpenRecordset(«Select VarType From
tblCharacter Where ID = » & iLoop)
strVarType = rsVarType!VarType ‘ Set the first Variable Type
string
Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From
tblCharacter Where ID = » & jLoop)
strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var
string
Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From
tblCharacter Where ID = » & jLoop)
strCllgFice = rsCllgFice!CllgFice ‘ Set the first College
Fice
string
Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr
From tblCharacter Where ID = » & jLoop)
strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first
College Enrollment Year string
Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From
tblCharacter Where ID = » & kLoop)
StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» &
strVarType & «-02May-MLM]»
strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & «
=
[LSAYFice-» & strVarType
strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.»
& strVarType & strCllgVar
strSQL = strSQL & » = [LSAYFice-» & strVarType &
«-02May-MLM].[» & strVarType & StrFiceYr & «]»
strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType
& strCllgVar & «) Is Null)»
strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» &
strCllgEnrollYr & «)=» & kLoop & «));»
qdf.SQL = strSQL ‘this stuffs your SQL string into the query
definition
‘the following resolves the VB parameter so
that
Access can understand it
For Each par In qdf.Parameters
par.Value = Eval(par.Name)
Next par

qdf.Execute ‘this should run the query
Next kLoop
Next jLoop
Next iLoop

End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType = affil
CllgVar = 31B
CllgFice = R30A1
CllEnrollYr = R31B
FiceYr = 06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON
LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET
LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND
((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access
Help came up with a screen about With Statements. Should I have nested
With
statements? How would I fit them in? (Have I done something to change my
object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so
that I can check what the module is actually producing? (something like a
DOS
echo function? — as you can tell, I’m fairly new at this. I’ve gotten as
far
as I have with this script with the help of people in the Access listserve
&
MS discussion groups)

Thank you in advance.

Marian Mitchell

Marian M.

  • #3

I have no idea. At one point, I had a different error message that quoted
this much of strSQL: «[LSAYFice-affil-02May-MLM].[affil06] WHERE
(((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1))»

How would I get VB to tell me what is in strSQL?

Marian

Douglas J. Steele said:

What’s actually in strSQL when the error occurs?


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Marian M. said:

I have written an Access VB module that, when I try to run it, reports
«Run-time error ‘2482’: Microsoft Office Access can’t find the name
‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the
line:
par.Value = Eval(par.Name), which I realize means that the problem is
somewhere before that line. But, the table =does= exist.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As
Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef ‘add these two
Dim par As Parameter

Set dbs = CurrentDb
With CurrentDb
Set qdf = dbs.QueryDefs(«MyQuery») ‘add this

For iLoop = 1 To 5
For jLoop = 1 To 18
For kLoop = 1 To 21
Set rsVarType = dbs.OpenRecordset(«Select VarType From
tblCharacter Where ID = » & iLoop)
strVarType = rsVarType!VarType ‘ Set the first Variable Type
string
Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From
tblCharacter Where ID = » & jLoop)
strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var
string
Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From
tblCharacter Where ID = » & jLoop)
strCllgFice = rsCllgFice!CllgFice ‘ Set the first College
Fice
string
Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr
From tblCharacter Where ID = » & jLoop)
strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first
College Enrollment Year string
Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From
tblCharacter Where ID = » & kLoop)
StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» &
strVarType & «-02May-MLM]»
strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & «
=
[LSAYFice-» & strVarType
strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.»
& strVarType & strCllgVar
strSQL = strSQL & » = [LSAYFice-» & strVarType &
«-02May-MLM].[» & strVarType & StrFiceYr & «]»
strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType
& strCllgVar & «) Is Null)»
strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» &
strCllgEnrollYr & «)=» & kLoop & «));»
qdf.SQL = strSQL ‘this stuffs your SQL string into the query
definition
‘the following resolves the VB parameter so
that
Access can understand it
For Each par In qdf.Parameters
par.Value = Eval(par.Name)
Next par

qdf.Execute ‘this should run the query
Next kLoop
Next jLoop
Next iLoop

End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType = affil
CllgVar = 31B
CllgFice = R30A1
CllEnrollYr = R31B
FiceYr = 06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON
LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET
LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND
((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access
Help came up with a screen about With Statements. Should I have nested
With
statements? How would I fit them in? (Have I done something to change my
object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so
that I can check what the module is actually producing? (something like a
DOS
echo function? — as you can tell, I’m fairly new at this. I’ve gotten as
far
as I have with this script with the help of people in the Access listserve
&
MS discussion groups)

Thank you in advance.

Marian Mitchell

Douglas J. Steele

  • #4

Before the line of code

qdf.SQL = strSQL

put

Debug.Print strSQL

After the code runs, the SQL string will appear in the Immediate Window
(which you can get to using Ctrl-G)

From a quick glance at the SQL, I don’t see where you have any parameters in
it, therefore I don’t understand why you’re trying to resolve parameters.


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Marian M. said:

I have no idea. At one point, I had a different error message that quoted
this much of strSQL: «[LSAYFice-affil-02May-MLM].[affil06] WHERE
(((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1))»

How would I get VB to tell me what is in strSQL?

Marian

Douglas J. Steele said:

What’s actually in strSQL when the error occurs?


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Marian M. said:

I have written an Access VB module that, when I try to run it, reports
«Run-time error ‘2482’: Microsoft Office Access can’t find the name
‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the
line:
par.Value = Eval(par.Name), which I realize means that the problem is
somewhere before that line. But, the table =does= exist.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As
Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef ‘add these two
Dim par As Parameter

Set dbs = CurrentDb
With CurrentDb
Set qdf = dbs.QueryDefs(«MyQuery») ‘add this

For iLoop = 1 To 5
For jLoop = 1 To 18
For kLoop = 1 To 21
Set rsVarType = dbs.OpenRecordset(«Select VarType From
tblCharacter Where ID = » & iLoop)
strVarType = rsVarType!VarType ‘ Set the first Variable
Type
string
Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From
tblCharacter Where ID = » & jLoop)
strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var
string
Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From
tblCharacter Where ID = » & jLoop)
strCllgFice = rsCllgFice!CllgFice ‘ Set the first College
Fice
string
Set rsCllgEnrollYr = dbs.OpenRecordset(«Select
CllgEnrollYr
From tblCharacter Where ID = » & jLoop)
strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the
first
College Enrollment Year string
Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From
tblCharacter Where ID = » & kLoop)
StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year
string
strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» &
strVarType & «-02May-MLM]»
strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice &
«
=
[LSAYFice-» & strVarType
strSQL = strSQL & «-02May-MLM].UNITID SET
LSAYCollVars_ACIS.»
& strVarType & strCllgVar
strSQL = strSQL & » = [LSAYFice-» & strVarType &
«-02May-MLM].[» & strVarType & StrFiceYr & «]»
strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» &
strVarType
& strCllgVar & «) Is Null)»
strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» &
strCllgEnrollYr & «)=» & kLoop & «));»
qdf.SQL = strSQL ‘this stuffs your SQL string into the query
definition
‘the following resolves the VB parameter so
that
Access can understand it
For Each par In qdf.Parameters
par.Value = Eval(par.Name)
Next par

qdf.Execute ‘this should run the query
Next kLoop
Next jLoop
Next iLoop

End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType = affil
CllgVar = 31B
CllgFice = R30A1
CllEnrollYr = R31B
FiceYr = 06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON
LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET
LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND
((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time,
Access
Help came up with a screen about With Statements. Should I have nested
With
statements? How would I fit them in? (Have I done something to change
my
object, CurrentDb?)

Is there a way to set this up so that the module spits out the query,
so
that I can check what the module is actually producing? (something like
a
DOS
echo function? — as you can tell, I’m fairly new at this. I’ve gotten
as
far
as I have with this script with the help of people in the Access
listserve
&
MS discussion groups)

Thank you in advance.

Marian Mitchell

Advertisements

Marian M.

  • #5

I put Debug.Print strSQL into the code where you said & found one incorrect
entry in tblCharacter. After fixing that, the code worked. Thank you. Why VB
comes up with error 2482 on a data entry error is another question.

On why the parameters, I started out trying to get the innermost loop to
work. At one point I got the error message: «Run-time error ‘3063’: Too few
parameters. Expected 1.». When I asked for help, someone told me to put in
both the qdf & the par bits. The resulting code worked. When I comment out
the three lines about parameters in the 3 loop code, error 3063 comes back.

Douglas J. Steele said:

Before the line of code

qdf.SQL = strSQL

put

Debug.Print strSQL

After the code runs, the SQL string will appear in the Immediate Window
(which you can get to using Ctrl-G)

From a quick glance at the SQL, I don’t see where you have any parameters in
it, therefore I don’t understand why you’re trying to resolve parameters.


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

Marian M. said:

I have no idea. At one point, I had a different error message that quoted
this much of strSQL: «[LSAYFice-affil-02May-MLM].[affil06] WHERE
(((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1))»

How would I get VB to tell me what is in strSQL?

Marian

Douglas J. Steele said:

What’s actually in strSQL when the error occurs?


Doug Steele, Microsoft Access MVP

(no e-mails, please!)

I have written an Access VB module that, when I try to run it, reports
«Run-time error ‘2482’: Microsoft Office Access can’t find the name
‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the
line:
par.Value = Eval(par.Name), which I realize means that the problem is
somewhere before that line. But, the table =does= exist.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As
Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef ‘add these two
Dim par As Parameter

Set dbs = CurrentDb
With CurrentDb
Set qdf = dbs.QueryDefs(«MyQuery») ‘add this

For iLoop = 1 To 5
For jLoop = 1 To 18
For kLoop = 1 To 21
Set rsVarType = dbs.OpenRecordset(«Select VarType From
tblCharacter Where ID = » & iLoop)
strVarType = rsVarType!VarType ‘ Set the first Variable
Type
string
Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From
tblCharacter Where ID = » & jLoop)
strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var
string
Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From
tblCharacter Where ID = » & jLoop)
strCllgFice = rsCllgFice!CllgFice ‘ Set the first College
Fice
string
Set rsCllgEnrollYr = dbs.OpenRecordset(«Select
CllgEnrollYr
From tblCharacter Where ID = » & jLoop)
strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the
first
College Enrollment Year string
Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From
tblCharacter Where ID = » & kLoop)
StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year
string
strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» &
strVarType & «-02May-MLM]»
strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice &
«
=
[LSAYFice-» & strVarType
strSQL = strSQL & «-02May-MLM].UNITID SET
LSAYCollVars_ACIS.»
& strVarType & strCllgVar
strSQL = strSQL & » = [LSAYFice-» & strVarType &
«-02May-MLM].[» & strVarType & StrFiceYr & «]»
strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» &
strVarType
& strCllgVar & «) Is Null)»
strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» &
strCllgEnrollYr & «)=» & kLoop & «));»
qdf.SQL = strSQL ‘this stuffs your SQL string into the query
definition
‘the following resolves the VB parameter so
that
Access can understand it
For Each par In qdf.Parameters
par.Value = Eval(par.Name)
Next par

qdf.Execute ‘this should run the query
Next kLoop
Next jLoop
Next iLoop

End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType = affil
CllgVar = 31B
CllgFice = R30A1
CllEnrollYr = R31B
FiceYr = 06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON
LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET
LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND
((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time,
Access
Help came up with a screen about With Statements. Should I have nested
With
statements? How would I fit them in? (Have I done something to change
my
object, CurrentDb?)

Is there a way to set this up so that the module spits out the query,
so
that I can check what the module is actually producing? (something like
a
DOS
echo function? — as you can tell, I’m fairly new at this. I’ve gotten
as
far
as I have with this script with the help of people in the Access
listserve
&
MS discussion groups)

Thank you in advance.

Marian Mitchell

I have an Access VB module that, when I try to run it, reports «Run-time error ‘2482’: Microsoft Office Access can’t find the name ‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the line: par.Value = Eval(par.Name), which I realize means that the problem is somewhere before that line.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef         ‘add these two
Dim par As Parameter

  Set dbs = CurrentDb
    With CurrentDb
      Set qdf = dbs.QueryDefs(«MyQuery»)    ‘add this

              For iLoop = 1 To 5
          For jLoop = 1 To 18
            For kLoop = 1 To 21
              Set rsVarType = dbs.OpenRecordset(«Select VarType From tblCharacter Where ID = » & iLoop)
              strVarType = rsVarType!VarType ‘ Set the first Variable Type string
              Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From tblCharacter Where ID = » & jLoop)
              strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var string
              Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From tblCharacter Where ID = » & jLoop)
              strCllgFice = rsCllgFice!CllgFice ‘ Set the first College Fice string
              Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr From tblCharacter Where ID = » & jLoop)
              strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first College Enrollment Year string
              Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From tblCharacter Where ID = » & kLoop)
              StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
              strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» & strVarType & «-02May-MLM]»
              strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & » = [LSAYFice-» & strVarType
              strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.» & strVarType & strCllgVar
              strSQL = strSQL & » = [LSAYFice-» & strVarType & «-02May-MLM].[» & strVarType & StrFiceYr & «]»
              strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType & strCllgVar & «) Is Null)»
              strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» & strCllgEnrollYr & «)=» & kLoop & «));»
      qdf.SQL = strSQL      ‘this stuffs your SQL string into the query definition
                            ‘the following resolves the VB parameter so that Access can understand it
              For Each par In qdf.Parameters
                par.Value = Eval(par.Name)
              Next par

      qdf.Execute   ‘this should run the query
            Next kLoop
          Next jLoop
        Next iLoop

    End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType    =    affil
CllgVar    =    31B
CllgFice =    R30A1
CllEnrollYr =    R31B
FiceYr =    06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access Help came up with a screen about With Statements. Should I have nested With statements? How would I fit them in? (Have I done something to change my object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so that I can check what the module is actually producing? (something like a DOS echo function? — as you can tell, I’m fairly new at this. I’ve gotten as far as I have with this script with the help of people in the Access listserve)

Thank you in advance.

Marian Mitchell

I have an Access VB module that, when I try to run it, reports «Run-time error ‘2482’: Microsoft Office Access can’t find the name ‘LSAYCollVars_ACIS’ you entered in the expression.» and highlights the line: par.Value = Eval(par.Name), which I realize means that the problem is somewhere before that line.

The code in question is
———
Sub CreateCharVars()

Dim strVarType As String, strCllgVar As String, strCllgFice As String
Dim strCllgEnrollYr As String, StrFiceYr As String, strSQL As String
Dim iLoop As Integer, jLoop As Integer, kLoop As Integer
Dim dbs As Database
Dim rsVarType As Recordset, rsCllgFice As Recordset, rsCllgVar As Recordset
Dim rsCllgEnrollYr As Recordset, rsFiceYr As Recordset
Dim qdf As QueryDef         ‘add these two
Dim par As Parameter

  Set dbs = CurrentDb
    With CurrentDb
      Set qdf = dbs.QueryDefs(«MyQuery»)    ‘add this

              For iLoop = 1 To 5
          For jLoop = 1 To 18
            For kLoop = 1 To 21
              Set rsVarType = dbs.OpenRecordset(«Select VarType From tblCharacter Where ID = » & iLoop)
              strVarType = rsVarType!VarType ‘ Set the first Variable Type string
              Set rsCllgVar = dbs.OpenRecordset(«Select CllgVar From tblCharacter Where ID = » & jLoop)
              strCllgVar = rsCllgVar!CllgVar ‘ Set the first College Var string
              Set rsCllgFice = dbs.OpenRecordset(«Select CllgFice From tblCharacter Where ID = » & jLoop)
              strCllgFice = rsCllgFice!CllgFice ‘ Set the first College Fice string
              Set rsCllgEnrollYr = dbs.OpenRecordset(«Select CllgEnrollYr From tblCharacter Where ID = » & jLoop)
              strCllgEnrollYr = rsCllgEnrollYr!CllgEnrollYr ‘ Set the first College Enrollment Year string
              Set rsFiceYr = dbs.OpenRecordset(«Select FiceYr From tblCharacter Where ID = » & kLoop)
              StrFiceYr = rsFiceYr!FiceYr ‘ Set the first Fice Year string
              strSQL = «UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-» & strVarType & «-02May-MLM]»
              strSQL = strSQL & » ON LSAYCollVars_ACIS.» & strCllgFice & » = [LSAYFice-» & strVarType
              strSQL = strSQL & «-02May-MLM].UNITID SET LSAYCollVars_ACIS.» & strVarType & strCllgVar
              strSQL = strSQL & » = [LSAYFice-» & strVarType & «-02May-MLM].[» & strVarType & StrFiceYr & «]»
              strSQL = strSQL & » WHERE (((LSAYCollVars_ACIS.» & strVarType & strCllgVar & «) Is Null)»
              strSQL = strSQL & » AND ((LSAYCollVars_ACIS.» & strCllgEnrollYr & «)=» & kLoop & «));»
      qdf.SQL = strSQL      ‘this stuffs your SQL string into the query definition
                            ‘the following resolves the VB parameter so that Access can understand it
              For Each par In qdf.Parameters
                par.Value = Eval(par.Name)
              Next par

      qdf.Execute   ‘this should run the query
            Next kLoop
          Next jLoop
        Next iLoop

    End With
End Sub
———

When iLoop, jLoop & kLoop all = 1,
VarType    =    affil
CllgVar    =    31B
CllgFice =    R30A1
CllEnrollYr =    R31B
FiceYr =    06

and the VB module should return the query
———-
UPDATE LSAYCollVars_ACIS LEFT JOIN [LSAYFice-affil-02May-MLM] ON LSAYCollVars_ACIS.R30A1=[LSAYFice-affil-02May-MLM].UNITID SET LSAYCollVars_ACIS.affil31b = [LSAYFice-affil-02May-MLM].[affil06]
WHERE (((LSAYCollVars_ACIS.affil31b) Is Null) AND ((LSAYCollVars_ACIS.R31B)=1));
———-

When I run this query as a query in Access, I have no problem.

Why would the VB module not recognize a table that exists?

Have I missed a syntax issue? When I hit F1 the most recent time, Access Help came up with a screen about With Statements. Should I have nested With statements? How would I fit them in? (Have I done something to change my object, CurrentDb?)

Is there a way to set this up so that the module spits out the query, so that I can check what the module is actually producing? (something like a DOS echo function? — as you can tell, I’m fairly new at this. I’ve gotten as far as I have with this script with the help of people in the Access listserve)

Thank you in advance.

Marian Mitchell

Понравилась статья? Поделить с друзьями:
  • Ошибка 2463 митсубиси л200
  • Ошибка 248 сбербанк
  • Ошибка 2463 мерседес
  • Ошибка 248 роблокс
  • Ошибка 248 куосера как исправить