-
I don't understand the purpose of a Function Procedure, is it neccessary and when?
I was doing some example from a book and it spoke about doing function procedures here is my code with out the FP
It says to do a function procedure for the Pay Rate but I don't what the purpose is..If so How could I do one...any help appreciated in advance, thank you
Const cFIFTYFIVE As Currency = 0.55
Const cFIFTY As Currency = 0.5
Const cSIXTY As Currency = 0.6
Const cSIXTYFIVE As Currency = 0.65
Dim iPiece As Integer
Dim stName As String
If stName = Empty Then
MsgBox "no message", vbInformation
End If
If IsNumeric(txtPieces.Text) Then
iPiece = Val(txtPieces.Text)
miCounter = miCounter + 1
If iPiece <= 199 Then
mcTotal = iPiece * cFIFTY
ElseIf iPiece <= 399 Then
mcTotal = iPiece * cFIFTYFIVE
ElseIf iPiece <= 599 Then
mcTotal = iPiece * cSIXTY
ElseIf iPiece >= 600 Then
mcTotal = iPiece * cSIXTYFIVE
End If
Else
MsgBox "Please enter a Numeric value in Piece", vbInformation, "No Piece Number"
End If
-
A Function procedure returns a value
Declare your functions like this: with arguments separeted with "," between the ()
Code:
Function Double(value as integer) as integer
Double=value*2
End function
Then you can call it like this
[code]
Dim a%
a=double(5)
msgbox a 'shows 10
[code]