473,394 Members | 1,700 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,394 software developers and data experts.

Run-time error '2465' - System can't find the field '|1'

So...I've wrote up a block of code calculating the total charge of a sale. However, it doesn't seem to be working, as whenever I try running the form, MS Access returns with a:

Runtime error '2465' - System can't find the field '|1' referred to in your expression.

The below is my code - it's pretty self explanatory, but I'd be happy to run you through each line if it's hard to understand:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Dim AdultPrice As Integer
  3.     Dim ChildPrice As Integer
  4.     Dim InfantPrice As Integer
  5.     Dim AdultsPrice As Integer
  6.     Dim ChildrenPrice As Integer
  7.     Dim InfantsPrice As Integer
  8.     Dim BaseRatePrice As Integer
  9.     Dim BaseMultiplier As Integer
  10.     Dim AccommodationType As String
  11.     Dim Duration As Integer
  12.  
  13.     If Me.Peak_Period.Value = "Yes" Then
  14.         AdultPrice = DLookup("BaseRate", "Base Rates", "Label = '" & "Adult - Peak" & "'")
  15.         ChildPrice = DLookup("BaseRate", "Base Rates", "Label = '" & "Child - Peak" & "'")
  16.     Else
  17.         AdultPrice = DLookup("BaseRate", "Base Rates", "Label = '" & "Adult" & "'")
  18.         ChildPrice = DLookup("BaseRate", "Base Rates", "Label = '" & "Child" & "'")
  19.     End If
  20.  
  21.     InfantPrice = DLookup("BaseRate", "Base Rates", "Label = '" & "Infant" & "'")
  22.  
  23.     AdultsPrice = [Me.Adults.Value] * AdultPrice
  24.     ChildrenPrice = [Me.Children.Value] * ChildPrice
  25.     InfantsPrice = [Me.Infants.Value] * InfantPrice
  26.  
  27.     BaseRatePrice = AdultsPrice + ChildrenPrice + InfantsPrice
  28.     AccommodationType = DLookup("AccommodationType", "Accommodations", "Accommodation ID = '" & Me.Accommodation.Value & "'")
  29.     BaseMultiplier = DLookup("BaseMultiplier", "Accommodation Types", "Label = '" & AccommodationType & "'")
  30.     Duration = DateDiff("d", [Arrival Date], [Departure Date]) + 1
  31.  
  32.     Me.Charge.Value = BaseRatePrice * BaseMultiplier * Duration


Thanks!
Dec 2 '15 #1

✓ answered by mbizup

You should drop the brackets in your control references...

AdultsPrice = [Me.Adults.Value] * AdultPrice

should be:

AdultsPrice = Me.Adults.Value * AdultPrice

etc.. for the other similar lines.

2 3014
mbizup
80 64KB
What line of code does it fail on? (ie: which line is highlighted when you click the 'Debug' button in the error message popup?)
Dec 2 '15 #2
mbizup
80 64KB
You should drop the brackets in your control references...

AdultsPrice = [Me.Adults.Value] * AdultPrice

should be:

AdultsPrice = Me.Adults.Value * AdultPrice

etc.. for the other similar lines.
Dec 2 '15 #3

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...
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...
4
by: Bruce Skamser | last post by:
I added a field to a table and when I go to the form to add a textbox control, I can't bind it to the field in the table. It doesn't come up in the list of fields in the control source dropdown. ...
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*...
1
by: chris | last post by:
I have a form that is labeled Document Control. On this form it calls an API Function to browse for a folder, puts its in to the text box and allows you to create a table out of the folders...
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...
4
kcdoell
by: kcdoell | last post by:
Hello: I have the following afterupdate event: Private Sub GWP_AfterUpdate() 'Updates the Total calculation in the control "SumGWP" on the quick reference 'table that is located on the form...
1
by: Andrew Hulting | last post by:
I am getting an erro on line 11, OpenDatabase(Name As String, , , ) I can leave the Options field blank, and it errors saying that the password is invalid, I am 100% certian that the password is...
4
by: Ian Strawser | last post by:
class Encrypt(object): #The worst object ever created def __init__(self,alphabet): self.alphabet = alphabet self.trans = self.maketrans() self.count = -1 ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.