Default Field Value

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

Guest

I am designing a form for purchases. I have 4 columns, Quanity, Price, Net
Price and Total. I am trying to set the default value in NetPrice to
=[Price], occasionally the Net Price and Price are not the same and i will
need to change the value of Net Price. When I set the default to =[Price] ,
the form ignores it and leaves the field blank. What am i doing wrong?
Thanks for your help

Carl
 
Default values are applied when you create a new record, and at that point
Price has no value.

Try something like this instead, in the AfterUpdate event procedure of the
control bound to the Price field ...

If IsNull(Me!txtNetPrice) Then
Me!txtNetPrice = Me!txtPrice
End If

In this example, 'txtNetPrice' is the name of the control bound to the Net
Price field, and txtPrice is the name of the control bound to the Price
field.
 
Carl:

The DefaultValue property determines what goes into a field in all new
records. What you want is to put the Price value entered into a record into
the NetPrice control for that same record. To do this put the following in
the AfterUpdate event procedure of the Price control:

Me.NetPrice = Me.Price

As soon as a price is entered the net price control will show the same
price. This can then be edited if necessary.

Ken Sheridan
Stafford, England
 
Back
Top