Help with a form field.

  • Thread starter Thread starter Mac
  • Start date Start date
M

Mac

I have a form used for data entry. The form enters details of trips taken by
groups on minibus (time, mileage etc). This information is used to perform
calculations to charge the group. However some groups recieve a pre-set
price for their regular journeys. I have a field for "set price" when the
charge is entered it overides all other calculations which are done to
calculate the price of the hire.

I would like to have a check box or button on the form for these regular
journeys, when checked the "set price" for the group (which is contained in
a table)would appear in the "set price" field. This would save me having to
look up the charge and entering it each time.

I hope this makes sense, and someone can assist me with this.

Many thanks.

Mike
 
Hello Mike,

Add an unbound checkbox on your form. In that checkbox's OnClick event you
add code to copy the amount to the "set price" control on the form. To be
sure it only copies the price when the checkbox is set, you should chek if
the checkbox is True before copying.

In case you have not used event proc's, you use the form's property sheet
and select Event procedure in the box next to the On Click property. Then
you click on the little build button next to the box. This will create an
empty event procedure and open the Visual Basic editor, where you can enter
the following.
If(Me.chkSetPrice = True) Then
Me.SetPrice = <Price goes here>
Else
Me.SetPrice = Null
End If
Where SetPrice is the name of the textbox on the form. I am assuming you
have a textbox bound to the "set price" field in the table.
If you want to get fancy you could store the set amount in a table where you
can modify it more easily.

Ragnar
 
Back
Top