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

GetListPrice error in OrderDetailsExtended form

Hi,

I have a set up an OrderDetailsExtended subform on an Order Form. I have used OrderDetailsExtended Query, these were both taken from the Northwind Database. On productID I have adjusted the VBA in the after update. But I am still getting an error when I add a new product to the order.
Expand|Select|Wrap|Line Numbers
  1. Private Sub CustPrice_AfterUpdate()
  2. Private Sub ProductID_AfterUpdate()
  3.     'Initialize price and discount for each product change
  4.     If Not IsNull(Me![ProductID]) Then
  5.         Me![Quantity] = 0
  6.         Me.Quantity.Locked = False
  7.         Me![CustPrice] = GetListPrice(Me![ProductID])
  8.         Me![Discount] = 0
  9.  
  10. End Sub
The GetListPrice is being highlighted in blue and I can not see how this is related to anything.

Any Help will be appreciated

warm wishes

Martin
Attached Images
File Type: jpg getlistprice.jpg (75.1 KB, 308 views)
Oct 10 '13 #1
6 2435
ADezii
8,834 Expert 8TB
  1. You cannot have two Sub-Routine Declarations withing the same Procedure as you have.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub CustPrice_AfterUpdate()
    2. Private Sub ProductID_AfterUpdate()
  2. GetListPrice() must be a 'Public' Function in a Standard Code Module.
Oct 10 '13 #2
Hi Thanks for getting back to be, I presume I remove the line
Private Sub CustPrice_AfterUpdate()as I am working in the ProductID field.

In regards to the second part I do not have GetListPrice in my Products table I have CustPrice as the field I want to match to. Could you explain how I do this. Thank you for your help
Oct 10 '13 #3
ADezii
8,834 Expert 8TB
  1. Post the Code for GetListPrice().
  2. What is the exact Error you are getting for a new Order?
  3. The Code you are referring to is in the AfterUpdate() Event of the Product ID Field in the Orders Subform, correct?
Oct 10 '13 #4
Expand|Select|Wrap|Line Numbers
  1. Private Sub ProductID_AfterUpdate()
  2.  
  3.       If Not IsNull(Me![ProductID]) Then
  4.         Me![Quantity] = 0
  5.         Me.Quantity.Locked = False
  6.        Me![CustPrice] = GetListPrice(Me![Product ID])
  7.         Me![Discount] = 0
  8.  
  9.  
  10. End Sub
That is the code you requested in number 1.
It came from where you described it in number 3.

The error message I am getting is compile error sub or function is not defined and the top of the codeis in yellow and the GetListPrice is in blue.

Thanks for all your help,

Martin
Attached Images
File Type: jpg compile error.jpg (22.3 KB, 481 views)
Oct 10 '13 #5

Oct 10 '13 #6
ADezii
8,834 Expert 8TB
  1. There is no [CustPrice] Field in the Record Source for the Sub-Form, Order Details Extended.
  2. You have a Space in the Argument ([ProductID]) to the Function Call where there should be none:
    Expand|Select|Wrap|Line Numbers
    1. Me![CustPrice] = GetListPrice(Me![Product ID])
    should be:
    Expand|Select|Wrap|Line Numbers
    1. Me![CustPrice] = GetListPrice(Me![ProductID])
Oct 10 '13 #7

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

Similar topics

2
by: JMCN | last post by:
hi - i have created a passthrough query and have it automatically connect to the odbc and then on a separate form, i have the user type in the date parameters. however when i run the following...
4
by: kathy | last post by:
Working in a form, I have an Iif statement where if a date is not filled in, another field will show as a blank. If the date IS filled in, the 2nd field will show its actual value. The following...
8
by: jv | last post by:
Hello, I have a continuous form that has a textbox named InvoiceAmount. This textbox is not a calculated field. It's control souce is a field also named InvoiceAmount in the tblInvoices table. ...
3
by: ad | last post by:
I use GenericErrorPage.aspx for the redirect page when some error occur. I want to show some different according error statusCode . How can I get error statusCode form Server.GetLastError()?
16
by: iwdu15 | last post by:
hi, i have a few forms in my project. when i load form1 (startup for) all is fine, then i open another one and use a login screen to call yet another and all is still fine, but then when i try to...
10
by: Norm | last post by:
I must not be understanding something about the use of forms in VB.Net that is different from VB. I have one form running in the background with an icon in the task bar. Right clicking on the icon...
2
by: Alan Silver | last post by:
Hello, I'm getting an odd validation error from VWD. As I understand it, an opening ASP.NET for tag is supposed to look like... <form runat="server"> with an optional ID attribute. VWD...
0
by: kammaldeep | last post by:
hi, i m newbie 2 PHP & to b frank ... will alwaz be ... i dont think i will go into much details with PHP as my work doesnot include workin with PHP bt i have a forum .. and i want to make a...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
1
by: williamcorrea85 | last post by:
HI , I HAVE TO CHANGE AN APLICATION MADE IN BORLAND C++ BUILDER 6, BUT WHEN I OPEN IT, IT SHOWS THE NEXT ERROR: ERROR READING FORM Class TabcShapeForm not found ANYONE KNOWS WHAT TO...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.