473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

AfterUpdate Event - runtime 2465 can't find field "|" referred to in your expression

kcdoell
230 100+
Hello:

I have the following afterupdate event:

Expand|Select|Wrap|Line Numbers
  1.  Private Sub GWP_AfterUpdate()
  2. 'Updates the Total calculation in the control "SumGWP" on the quick reference
  3. 'table that is located on the form
  4.  
  5.     With Me![SumGWP]
  6.     DoCmd.Requery
  7.  
  8.   End With
  9. End Sub 
This worked perfectly. Then I applied code to various objects so that a new record could not be written unless certain conditions existed. In the case of my object "GWP", the value has to greater than 0:

Expand|Select|Wrap|Line Numbers
  1. 'Make sure required fields are filled out first
  2.  
  3. Dim frm As Form
  4. Set frm = Forms!Forecast
  5.  
  6. If IsNull(frm![Policy_Type]) Or IsNull(frm![Insured_Name]) _
  7. Or IsNull(frm![LOB]) Or Nz([GWP], 0) = 0 Or Nz([NWP], 0) = 0 _
  8. Or IsNull(frm![Binding_Percentage]) Then
  9.  
  10. If IsNull(frm![Policy_Type]) Then MsgBox "Please select a Policy Type from" & _
  11.     " the list, thank you", 64, "Select a Policy Type"
  12.  
  13. If IsNull(frm![Insured_Name]) Then MsgBox "Please indicate who the Insured" & _
  14.     " is, thank you", 64, "Select an Insured"
  15.  
  16. If IsNull(frm![LOB]) Then MsgBox "Please choose a LOB from the" & _
  17.     " list, thank you", 64, "Select an LOB"
  18.  
  19. If Nz([GWP], 0) = 0 Then MsgBox "Please input a GWP value for the" & _
  20.     " record, thank you", 64, "Input a GWP Value"
  21.  
  22. If Nz([NWP], 0) = 0 Then MsgBox "Please input a NWP value for the" & _
  23.     " record, thank you", 64, "Input a NWP Value"
  24.  
  25. If IsNull(frm![Binding_Percentage]) Then MsgBox "Please choose a Binding Percentage from" & _
  26.     " the list, thank you", 64, "Select a Binding Percentage"
  27.  
  28. Cancel = True
  29. Else: Cancel = False
  30. End If
  31.  
  32. 'If all req fields are populated then proceed to write the record to the forecast table.
My problem is that if GWP is 0, I get the error message. That is what I wanted to happen but when I input a value greater than 0 and tab into my next object "NWP", I get the following error"

Expand|Select|Wrap|Line Numbers
  1. runtime 2465 can't find field "|" referred to in your expression
The debug window focuses on the
Expand|Select|Wrap|Line Numbers
  1. With Me![SumGWP]
  2.     DoCmd.Requery 
  3.   End With
  4. End Sub 
Highlighting the DoCmd.Requery….

I have been doing a lot of research on the Internet but can not find a solution. Does anybody understand what my issue could be? During my research it indicated that this message could mean that it can not find the object, but that was not an issue before I put in the required field error messages.

Any ideas would be helpful.

Thanks,

Keith.
Apr 15 '08 #1
4 3204
Stewart Ross
2,545 Expert Mod 2GB
Hi Keith. Can't see any obvious cause for the error in the code as posted. Having said that you are mixing the syntax for the requery a little - you don't need the With or the DoCmd. The syntax is just
Expand|Select|Wrap|Line Numbers
  1. Private Sub GWP_AfterUpdate()
  2.   Me![SumGWP].Requery
  3. End Sub 
The other checking lines don't explain why you should be getting an error. If you find you are still getting the error after simplifying the requery line as above, could you post the calculation you use for your SumGWP field that is being requeried? It may be that there is something wrong there instead.

-Stewart
Apr 15 '08 #2
kcdoell
230 100+
Hi Keith. Can't see any obvious cause for the error in the code as posted. Having said that you are mixing the syntax for the requery a little - you don't need the With or the DoCmd..................
Stewart:

I just got back and thanks for the reply. I am going to probe a little further trying your suggestion and get back to you........
Apr 15 '08 #3
kcdoell
230 100+
Stewart:

Simplifying the requery coding as you suggested seems to have worked. I now can not recreate the error. This was the first time I wrote that kind of code and it did work before I proceed with other VB coding. I am always interested in streamlining how I write stuff but I have learned all by doing and none by formal training.

Thanks, I would not have figured it out without your help.

For kicks my code for the SUMGWP was the following:

Expand|Select|Wrap|Line Numbers
  1.  =DSum("[GWP]","ReQryForecast","Val([Binding_Percentage]) >= 75") 
This I placed in the control source property of my text box control….

Thanks again,

Keith.
Apr 15 '08 #4
missinglinq
3,532 Expert 2GB
For doing this one simple thing, using the With construct was really overkill, and Stewart's suggestion was spot on, as always. But if you needed to use the With because you were also doing other things, the proper syntax would have been

Expand|Select|Wrap|Line Numbers
  1.  Private Sub GWP_AfterUpdate()
  2. With Me![SumGWP]
  3.   .Requery
  4. End With
  5. End Sub 
omitting the DoCmd.

Linq ;0)>
Apr 16 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JMCN | last post by:
hello i receive a runtime error '2465' whenever i run my module in access 97. it says 'Run-time error '2465' OOB Reports can't find the field "DuplicatePayments' referred to in your...
2
by: Evil | last post by:
This is likely a very simple question, but one which is leaving me a bit confused. i have an image control on a report in Access97 then in the Detail's ON FORMAT Event, i have: Private Sub...
3
by: MIG | last post by:
I had a form which used year(date) to compare an input value with the year of today's date. This was working fine. Now, for some reason, I am getting run-time error 2465 "Library Catalogue...
6
by: MLH | last post by:
"The following unexpected error occurred in Sub CopyMySQLbttn_Click, line #250, CBF on frmVehicleChooserform. 2465: "Can't find the field 'forms' referred to in your expression. You may have...
2
by: PW | last post by:
Hi, What the heck is that supposed to mean? I am getting this error on a "Me.Requery" line in a subroutine on a form, but only when I select something from a combo/dropdown box. The *exact*...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
6
imrosie
by: imrosie | last post by:
hello experts, Im a newbie in need of someone's experience. I have an image repository db that allows the input and search images just fine. However, if I want to erase an image, the subroutine...
3
by: ontherun | last post by:
hi, i have two forms CHS_Customer and 'CHS_Job' both have a common field, "Company_Name" i want to open the form 'CHS_Job' from the form 'CHS_Customer ' and when i open, the Company_Name field...
2
by: zufie | last post by:
I have an Option GROUP which produces 6 different report between two dates. A separate Option BUTTON determines the period of the report once I enter the From & To Dates into the textboxes. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.