Hi,
I'm trying to make a button on a custom form which will automatically calculate volume when thickness, length and width are entered by the user. I would like the volume value to appear in a box that is linked to a volume field which will also be populated after the value has been calculated. I've created a script and a button. In the button events I have it set to "Call CalculateVolume" when clicked and the following script is what it calls.
Sub CalculateVolume
'Initializing Variables
Dim thickness, length, width, volume
'Setting variables equal to the user inputs
thickness = InputBox("txtMaterial_thickness")
length = InputBox("txtMaterial_length")
width = InputBox("txtMaterial_width")
'Calculating volume with the user inputs
volume = thickness * length * width
MsgBox("Volume " & volume & " Metres cubed")
'Assigning the volume value to the volume box
InputBox("txtMaterial_volume") = volume
End Sub
Thanks!
Emily