Old Value Help Please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all and thanks in advance

I have a subform with the following field layout

[GBPValue] [PriceBreakQty1] [PriceBreakQty2]
[GBPValue] [PriceBreakQty1] [PriceBreakQty2]
[GBPValue] [PriceBreakQty1] [PriceBreakQty2]

I also have an unbound text box which is set to [PriceBreakQty2] Value Call
this [PBCal]
I am using the Value in the unbound text box to predict the steps for
PriceBreakQty1

Rather like IIf(PBCal=0,[PriceBreakQty1]=1,[PriceBreakQty1]=PBCal+1) to
arrive at the following

[GBPValue] [PriceBreakQty1] [PriceBreakQty2] [PBCal]
£100 1 100 100

This first part works ok but the value in PBCal is set to 0 when a new
record is added which means the default calculation is again set to 1 instead
of 101, how can I retain the value or lookup the oldvalue

I would appreciate your assistance
 
Mike,

Apologies if I am speaking out of turn here. But I am afraid I can't
understand what this is all about, so I am guessing that others may be
having difficulty making sense of it as well. Maybe you could post back
with some further explanation, or additional examples? Thanks.
 
I will try to explain the situation more clearly, sorry for the first attempt.

I have an acces quotation programme which has a main form, a sub form and a
sub form within the first sub form. The reason for this is, the front form
records the customer and quotation team members information. The first sub
form records the part number and general part information. the final sub form
records the price break information for a quoted part.

I want to auto fill information in most cells to save the operator time and
reduce the possibility of errors. My problem is with the final sub form where
I have the fields as described in my first attempt at the explanation.
However, there are numerous sub records which are related to the first sub
level form which in turn has 4 or 5 records relating to the front form.

Final Sub Form
(Sub Record 1) [GBPValue] [PriceBreakQty1] [PriceBreakQty2]
(Sub Record 2) [GBPValue] [PriceBreakQty1] [PriceBreakQty2]
(Sub Record 3) [GBPValue] [PriceBreakQty1] [PriceBreakQty2]

(There are other fields but these are not improtant so I have left them out)

What I want to do is find a way to auto fill in the default value for the
price break as follows. I am using a unbound text box to see what is entered
in [Price BreakQty2] for the default of [PriceBreakQty1]

(Sub Record 1) [GBPValue] [PriceBreakQty1] [PriceBreakQty2] [PBCal]
(Values) £125 0 0
0
Default Value 1
(after Entry) £125 1 10
10

(Sub Record 2) [GBPValue] [PriceBreakQty1] [PriceBreakQty2] [PBCal]
(Values) £122 0 0
0
Default Value 1
Reqd Default 11 (From previous value of
[PriceBreakQty2]

As you will see, with a new record, [PBCal] is set back to zero because
there is nothing in [PriceBreakQty2] for Sub Record2 so I want [PBCal] to see
the previous value of 10+1 to arrive at the next step for the
[PriceBreakQty1] Default Value

I am sorry if this is still not clear, if you cann assist it will allow me
to determine the steps that enetered and prefill the cell [PriceBreakQty1] if
steps are in 1, 10, 100 or 1000's or any other combination 5's for instance.
 
Mike,

I can't see the necessity for the [PBCal] at all.

On the Before Insert event of the subsubform, put code like this...
Me.PriceBreakQty1 = DMax("[PriceBreakQty2]","YourTableName","[fred]=" &
me.fred)+1
(where 'fred' is the name of the field that links the subsubform
records to the subform).

Is that what you mean?
 
Steve, Thanks a million for your assistance, I had just worked out how to do
the job using the before update section of the form but it still uses PBCal,
I will now try your version which I think sounds better than my ham efforts.
Thanks again and sorry to have taken your time up. I think perhaps I should
have posted this in the access forms Group but we live and learn.

Thanks once again
 
Mike,

Let us know if you need any further help.

Yes, the .forms newsgroup would have been appropriate, but so is this one.
 
Back
Top