RE: does this sql capability exist
- From: SteveS <limbim53 at yahoo dot com>
- Date: Fri, 23 Mar 2007 06:44:16 -0700
Hi Dan,
I'm not quite sure what you are trying to do, but I can think or a couple
more ways to dynamically create the SQL statement.
If I understand right, you have fields in "tblCorePart" that are named
"1-9", "10-19", etc??? If so, you need to rethink your table structure. That
is the way you might set up a spreadsheet, but it is the wrongway for a
database.
For example, what happens if you need to have a price for 1-25 items instead
of 1-9 items for a new product. You might say "That will never happen".
Famous last words... <g>
I would set up the table "tblCorePart" something like this:
Field Name: Data Type:
lngCorePartID Autonumber (PK)
lngPartNumber Long Int (FK)
Quan_Min Integer
Quan_Max Integer
curPrice Currency
The "Parts" table would be like:
Field Name: Data Type:
lngPartID Autonumber (PK)
txtPartNumber Text
txtPartDesc Text
(other fields)
BTW, your first quanity is 9 items and all the rest are multiples of ten
items. I would have thought the groups would be 1-10, 11 20, 21-50 , ...
(just curious)
You might want to read up on database normalization. I keep a couple of
books nearby to refer to when setting up new tables.
Now for Question 1: "dynamic SQL". Using VBA, you could build the SQL using:
a series of 10 IF() statements,
a listbox and loop thru the selected items or
give the textboxes a common name (Quan1, Quan2,...) and loop from 1 -10
Question 2: I would have to answer "It depends". Are the prices time/date
sensetive? Do you need a historical record of the prices? What are the
business rules? Do you save the quoted price with in the quote record(s)? Do
you convert the quote to a PO or create a separate PO later? Does the set up
fee change - by customer, by product, quanity, time of year?????
HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
"ddungan@xxxxxxxxxxxxxxxxxxx" wrote:
Hi,.
I have two questions:
1. Is there a way to dynamically choose which fields are included in
an sql statement based on if there is a value entered in text boxes?
I have 10 text boxes that represent 10 of the fields in my table
tblCorePart. These text boxes are labeled with quantity ranges.
These are the ten fields:
Table: tblPriceListCore
Field Name: Data Sample: Description:
ID Primary
Key
CORE_PART 217 Part Number
ADAPTER_CONFIG R
1-9 $10.47 Price for 1-9
items
10-19 $ 9.70 Price for 10-19
items
20-49 $ 9.47 Price for 20-49
items
50-99 $ 7.46 etc.
100-249 $ 5.98 etc.
250-499 $ 4.81 etc.
500-999 $ 4.25 etc.
1000-2499 $ 3.67 etc.
2500-4999 $ 3.33 etc.
5000 up $3.17 etc.
2. I need to use the value of the text box in a calculation for a
price mark up. Where should I store the value?
So after a customer service agent enters the part number in the form
frmBuildQuote. They enter the actual quantity in a text box. The agent
may enter as many as 4 quantities to quote. I need to divide the set
up fee by the actual quantity and add that to the quoted price.
I actually have many more questions, but I had to start somewhere.
I'm a new access developer. I just got this job, and I would truly
appreciate discussing this with someone.
Thanks,
Dan Dungan
- Follow-Ups:
- Re: does this sql capability exist
- From: ddungan
- Re: does this sql capability exist
- References:
- does this sql capability exist
- From: ddungan
- does this sql capability exist
- Prev by Date: Re: Conversion to Access 2007
- Next by Date: Re: Microsoft Access: How do I create a drop down list that stores the index value, but displays text value?
- Previous by thread: Re: does this sql capability exist
- Next by thread: Re: does this sql capability exist
- Index(es):
Relevant Pages
|