I have e fields on my form, one named txtFreightCharge that is a textbox and is used for Freight and Handling Charges
The other is a checkbox that when checked applies the customers standard freight charge. It is named ApplyShipRate
I want one or the other to be able to be used, not both. If users checks checkbox and the tries to update textbox, it will be disabled and reversed for the other option. If user chooses to add their own value using the textbox, then the checkbox will be disabled until they clear the textbox with a messagebox that they cant use both.
I am trying something like this but unsure of how to add the message box about they cant use both.
If Me.txtFreightCharge.Value > 0 Then 'User chooses their own Freight Charge
Me.ApplyShipRate.Enabled = False
Else
Me.ApplyShipRate.Enabled = True
End If
If Me.ApplyShipRate = True Then 'User chooses to apply Customers ship rate
Me.txtFreightCharge.Enabled = False
Else
Me.txtFreightCharge.Enabled = True
End If
___________________________________
Code that is used if user clicks on ApplyShipRate;
Private Sub ApplyShipRate_AfterUpdate()
If ApplyShipRate = False Then ' Set Freight To Zero
[FreightCharge] = 0
Me.Requery
End If
If ApplyShipRate = True Then ' Set Taxes To Customers ShipRate
[FreightCharge] = [Text133] * [txtOrderSubtotal] 'Text133 is Customers Freight Charge Rate
Me.Requery
End If
End Sub
I forgot, code should set ApplyShipRate to null; Here is code for txtFreightCharge
Private Sub txtFreightCharge_AfterUpdate()
Me.Label135.Visible = True ' Label for ApplyShipRate
Me.ApplyShipRate.Enabled = True 'Checkbox is enabled
Me.ApplyShipRate = Null 'checkbox is set to null,i.e. unchecked.
End Sub