I have a table which stored the part nos, qty, price. The Part Nos is repeated cos the qty and price is different.It base on qty volume.
PART NO QTY PRICE
A-0123 1000 1.5
A-0123 7000 1.0
I want to retrieve the correct price base on qty input by user. If user input Part Nos = A-0123, and Qty= 6000, then I should retrieve the price at 1.5. If user enter 10,000 then I should retrieve 1.0.
I have no idea, this is tough for me, Please help
3 1400 NeoPa 32,556
Expert Mod 16PB
It would certainly help if the question made more sense... or if the Table name were provided... or you told us where you were trying to use the info.
In the absence of all that I will just have to guess.
I'm assuming you are entering the quantity on a form in the text box txtQty and you want to populate the label lblPrice.
The table used is tblPrice and the product code is displayed on the form in txtProduct.
I'm also assuming that the record layout is as shown ([Part No],[Qty] & [Price]). - Private Sub txtQty_AfterUpdate()
-
Dim curPrice As Currency
-
Dim strWhere As String, strResult As String
-
-
strResult = "Format([Qty],'0000000000') & [Price]"
-
strWhere = "(([Part No]='" & txtProduct & "') AND " & _
-
"([Qty]<=" & txtQty & "))"
-
curPrice = CCur(Mid(DMax(strResult, "tblPrice", strWhere), 11))
-
lblPrice.Caption = Format(curPrice , "Currency")
-
End Sub
It would certainly help if the question made more sense... or if the Table name were provided... or you told us where you were trying to use the info.
In the absence of all that I will just have to guess.
I'm assuming you are entering the quantity on a form in the text box txtQty and you want to populate the label lblPrice.
The table used is tblPrice and the product code is displayed on the form in txtProduct.
I'm also assuming that the record layout is as shown ([Part No],[Qty] & [Price]). - Private Sub txtQty_AfterUpdate()
-
Dim curPrice As Currency
-
Dim strWhere As String, strResult As String
-
-
strResult = "Format([Qty],'0000000000') & [Price]"
-
strWhere = "(([Part No]='" & txtProduct & "') AND " & _
-
"([Qty]<=" & txtQty & "))"
-
curPrice = CCur(Mid(DMax(strResult, "tblPrice", strWhere), 11))
-
lblPrice.Caption = Format(, "Currency")
-
End Sub
Sorry for not giving you more detail as I was too work out on the problem and forget to provide you more detail, But you have guess 100% correctly, and thank for that hard to find coding, and exactly what I want, I have tried it out, it work.
Thank You So Much and Happy New Year to You.
NeoPa 32,556
Expert Mod 16PB
You're welcome.
Happy New Year :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John Cho |
last post by:
// CHO, JOHN
#include<iostream>
class fracpri{
int whole;
int numer;
int denom;
|
by: Alf P. Steinbach |
last post by:
The fifth part of my attempted Correct C++ tutorial is now available,
although for now only in Word format (use free Open Office if no Word), and
also, it's not yet been reviewed at all -- ...
|
by: Blake |
last post by:
Below is the queries and the results I get when in psql monitor>
QUERY 1: SELECT id,price FROM store ORDER by price ASC;
RESULT : List from LOWEST price to HIGHEST price
QUERY 2: SELECT...
|
by: homepricemaps |
last post by:
hey folks,
have a logic question for you. appreciate the help in advance.
i am scraping 3 pieces of information from the html namely the food
name , store name and price. and i am doing this...
|
by: Mike |
last post by:
Hello NG,
i am just learning various Design Patterns and now i am not sure, if
this design is correct (Builder) or if i should use an other pattern.
I have various classes (here ChildA and...
|
by: Tony K |
last post by:
While performing a fill() method, the first record NEVER shows the correct
price of database item. The 2nd record and every record that has a price
will show the correct price. If I open the...
|
by: Generic Usenet Account |
last post by:
I ran a small experiment involving RTTI and dynamic casting.
Basically what I did was to cast a base class pointer to a derived
type (yes, I know that is not kosher). I then performed...
|
by: Moneypenny |
last post by:
Hi there,
I have a Gridview control which has a dropdownlist in every row. The dropdowns are populated dynamically from a database (so the content is different in each row. There is also a select...
|
by: Ravi |
last post by:
Is this the correct way to think of "base class"?
The "base class" is a class from which other classes are derived.
The "base class" will never be derived from another class.
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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$) {
}
...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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...
| |