Set default then update text box

scouser

Registered User.
Local time
Today, 02:01
Joined
Nov 25, 2003
Messages
767
Hi Access World Forums, it has been many years since my last post :)

I have a Order Form (continuous) that allows user to select a product. After selection 2 text boxes are updated (Description and Price) see code below:

Code:
Private Sub cboPackageID_AfterUpdate()
 Me.PackageDescription = Me![cboPackageID].Column(1)
 Me.PackagePrice = Me![cboPackageID].Column(2)
End Sub

On the same form I have a quantity text field. If I manually enter value (i.e. 1) AfterUpdate event triggers and populates text field 'Line Total'.

What I would like to do is after a value is selected from cboPackageID the quantity is set to 1 and the line total updates.

Kind Regards,
Phil.
 
I have worked it out...

Code:
Private Sub cboPackageID_AfterUpdate()
 Me.PackageDescription = Me![cboPackageID].Column(1)
 Me.PackagePrice = Me![cboPackageID].Column(2)
 Me.Quantity = 1
 Me.LineTotal = Me.Quantity * Me.PackagePrice
End Sub

I thought it would be more complicated.

Thanks,
Phil.
 
You can trigger event by using the Call method, provided they are withing the same Form module.. So your code becomes..
Code:
Private Sub cboPackageID_AfterUpdate()
    Me.PackageDescription = Me![cboPackageID].Column(1)
    Me.PackagePrice = Me![cboPackageID].Column(2)
    Me.quantityControlName = 1
    Call quantityControlName_AfterUpdate()
End Sub
If you wish to trigger them from another From you should Set the Focus, add a value and move the Focus away..
 

Users who are viewing this thread

Back
Top Bottom