I have a table called tblPrice consist of ProductID, SupplierID, Qty and Price,
Which I use to store the pricing.
Different Supplier may quote a different price on a same product base on Qty Purchase.
At the end of the day, so I can see which Supplier quoted the lowest price, so I can purchase from that supplier.
The format of the table as below:-
[TBLPRICE]
PRODUCTID | SUPPLIERID | PUR QTY | PRICE
BT-0007 SP0001 1,000 $1.50 (from 1k onward)
BT-0007 SP0001 5,000 $1.30
BT-0007 SP0001 12,000 $1.20 (from 12k onward)
BT-0007 SP-0007 1,000 $1.56
BT-0007 SP-0007 5,000 $1.35
BT-0007 SP-0007 12,000 $1.25
In the Form, I have 2 textbox - txtProdID, txtQty, If I enter BT-0007 for ProdID and 7000 for Qty
it will show the result like this : -, regardless whether in report or form.
BT-0007 SP0001 $1.30
BT-0007 SP-0007 $1.35
So I can see & compare the lowst price.
I have tried using query, it didn;t work, Any Solution ?
3 1567
Can you explain how this is different from the question in (How to look up for the correct price base on qty)?
Maybe I'm missing something obvious (other than there is more info posted here :) of course).
Thanks, It sound similar to the previous question, which able to search for the right currency base on the qty. This question was to display the entire row, this mean to display along with the supplier name, price, the table could repeat the same product with many different supplier quoting the same qty, but the price maybe different, therefore I need to search for the lowest price.
NeoPa 32,556
Expert Mod 16PB
I'm getting so frustrated to be wasting so much time on simple communication.
I'm sorry, but the only sense I could get from all that was that you want a whole record rather than a single value.
Why do you miss out words and letters and such like from an explanation? Do you want to make it hard to understand? Can you understand it if you reread it?
Please ignore this tirade if you are not a native English speaker - Then it would be understandable and a restriction I'm happy to work within.
Otherwise, I will simply ignore a post in future if it is not clear on the first couple of readings.
I went back to the first post and re-read it in detail and I think I've got what you're asking now.
You need a ComboBox to show the results and the RowSource of the ComboBox (We will call it cboResults) should be set like : - Private Sub txtProdID_AfterUpdate()
-
Call ComboSource
-
End Sub
-
-
Private Sub txtQty_AfterUpdate()
-
Call ComboSource
-
End Sub
-
-
Private Sub ComboSource()
-
Dim strSQL As String, strPrice As String
-
-
If Nz(txtProdID, "") = "" Or Nz(txtQty, 0) = 0 Then
-
strSQL = ""
-
Else
-
strPrice = "CCur(Mid(Max(" & _
-
"Format([Pur Qty],'0000000000') & " & _
-
"[Price]),11)) "
-
strSQL = "SELECT ProductID," & _
-
"SupplierID," & _
-
strPrice & _
-
"FROM tblPrice " & _
-
"WHERE ((ProductID='" & txtProdID & "')" & _
-
" AND ([Pur Qty]<=" & txtQty & ")) " & _
-
"GROUP BY SupplierID"
-
End If
-
cboResults.RowSource = strSQL
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Greg |
last post by:
I have a page that searches a database by a repairman's name and by a
date range. It pulls info by the repairman's name but pulls all info in
the database regardless of the date. Below is the code...
|
by: Eric |
last post by:
Hi: I have two files. I search pattern ":" from emails text file and
save email contents into a database. Another search pattern " field is blank. Please try again.",
vbExclamation + vbOKOnly...
|
by: zfareed |
last post by:
<code>
#include <iostream>
#include <fstream>
const int MAX_LENGTH = 10;
using namespace std;
|
by: Simon Gare |
last post by:
Hi,
have a search.asp page with results.asp page drawing data from an SQL db,
problem is the user has to type the whole field value into the search box to
retrieve the value on results.asp, what...
|
by: mwalsh62 |
last post by:
Greetings all!
My first post here, and my mind is pudding at this point (any flavor you like)!
I have been searching for days, and still can't figure out the proper syntax that I require. This...
|
by: silentbuddha |
last post by:
Hi, I am currently having some difficulties with this sunroutine that I created. My 2 dimensional array is empty.
- This code is within my UserForm1
- this sub is suppose to first select the...
|
by: Bart Kastermans |
last post by:
Summary: can't verify big O claim, how to properly time this?
On Jun 15, 2:34 pm, "Terry Reedy" <tjre...@udel.eduwrote:
Thanks for the idea. I would expect the separation to lead to
somewhat...
|
by: jotr |
last post by:
I recently received help writing a search macro for excel, but now I am trying to change it up to use it in another spreadsheet, and I am having some troubles. I need it to search two cells one has...
|
by: jotr |
last post by:
I posted this question already (Admin Edit Need help with my search macro for excel), but I made a mistake in writing the question, so I posted a reply and I am afraid that at a glance it may be...
|
by: Kelicula |
last post by:
Why?:
One commonly used algorithm is the binary search.
If you don't already know it, you should read on.
Very helpful. Saves much CPU. Reduces computations exponentially.
When searching...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
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: 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...
|
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...
| |