Also, you need to make sure to not display the Summary form before any data is entered; you cannot calculate a total or an average when no items have been calculated. You can either check the number of employees or disable the Summary menu command until the first order has been calculated. If you choose to disable the Summary menu command, be sure to de-select the Enabled check box when setting it up in the Menu Editor. You will then need to enable it in your code at the right time.
Summary Menu Command
Summary Form
The Summary form should display the summary information. The summary information is as follows:
1. Total number of pieces
2. Total number of employees
3. Total pay for all employees
4. Average pay for all employees
The summary information should appear when the form is initially displayed. This form should also include two command buttons, a Back button and a Quit button. The Back button will close the Summary form and go back to the Main form. The Quit button will display a message box to make sure the user would really like to quit the program. If the user selects Yes, terminate the program. If the user selects No, close the Summary form and display the Main form.
Displays the Summary form and all necessary summary information
Pieces Completed
1-199
200-399
400-599
600 Or more
Price Paid per Piece
$0.50
$0.55
$0.60
$0.65
Last edited by Franklin67; Oct 2nd, 2005 at 08:38 AM.
1-199 Pieces completed the price per piece is $.50
200-399 Pieces completed the price per piece is $.55
400-599 Pieces completed the price per piece is $.60
600+ Pieces completed the price per piece is $.65
Then, using the power of common sense, you obviously have to tally first the total quantity completed (and store its value in a variable) before doing additional computations involving rate per piece.
That's not an excuse unless ..... is VB being taught in elementary nowadays?
Come on! A little effort on your part pls.
You get the totalpcs with addition
You then multiply this with any of the four rates (0.5, 0.55, 0.6, 0.65) with a select case structure or an if...then...elseif structure, I suggest you use the select case.
All the info is available in MSDN. For now you need to look up the syntax and use of select case
Also by looking up msdn, you might come across other info you will need for this assignment. Instead of asking about every single detail.
Last edited by leinad31; Oct 2nd, 2005 at 10:37 AM.
Somewhat off topic: A humble attidude will get you further in life
on topic: I'll try to code something later tonight, I just need to get in vb-mood
OFF TOPIC: your "on topic" promise shouldn't really be there - we don't do homeworks for anybody - we try to help to solve some particular problem(s) unless it's some "major issue" which is obviously NOT the case here.
You don't declare a procedure (the function) within another procedure (the sub)
VB Code:
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency
'''
Select Case lngTotalPcs.
Case 1 To 199
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalPcs * 0.60
Case Is > 599
GetPayPerEmp = ingtotal * 0.65
End Select
End Function
To call this elsewhere, such in CmdSummary_Click() procedure you do:
Dim CalculatedPay As Currency
Dim lngSampleVar As Currency
'Let's assume 150 pcs to be used as parameter for the function call stored in variable lngSampleVar
lngSampleVar = 150 'assigned 150 based on previous calculations
CalculatedPay = GetPayPerEmp(lngSampleVar)
'CalculatedPay would then become equal to 75 because thats the value returned by the function call
Last edited by leinad31; Oct 3rd, 2005 at 09:00 AM.
OFF TOPIC: your "on topic" promise shouldn't really be there - we don't do homeworks for anybody - we try to help to solve some particular problem(s) unless it's some "major issue" which is obviously NOT the case here.
Well, I never ment to make a complete program, just read the description and guide the guy a little bit. He should of course try to do most of it himself, but its he's completely lost its nice to get some guidance on how to tackle the assignement
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
(ONLY THis one)
Dim curAverage As Currency
Dim intQuantity As Integer
Dim curAmount As Currency
Dim strMessageString As String
Dim strFormattedAvg As String
Dim strFormattedPay As String
Dim curPrice As Currency
Dim CalculatedPay As Currency
Dim lngSampleVar As Currency
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
Case 1 To 199
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Function
and now am i missing anything ?
Last edited by Franklin67; Oct 3rd, 2005 at 09:10 AM.
there's something wrong with the vbcode tags, the function declaration ought to finish with as currency, select case should be on the next line. I had to insert comment characters to get them to go to the next line.
And the function is declared separately... not nested in the sub procedures declaration
Oh btw, I believe your gonna use that only for the pay per employee (total pcs sold by employee to get corresponding pay given to him). For the summary form, the computations are different. You get the totals including totals of pay per employee and then divide to get the average.
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
This one gives me the error
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
Case 1 To 199
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Sub
End Function
where do i put Public Function
&
End Function ?
did i miss anything else ?
Last edited by Franklin67; Oct 3rd, 2005 at 09:33 AM.
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
This one gives me the error
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs.
Case 1 To 199
GetPayPerEmp = lngTotalPcs * 0.5
Case 200 To 299
GetPayPerEmp = lngTotalPcs * 0.55
Case 400 To 599
GetPayPerEmp = ingtotalpcs * 0.6
Case Is > 599
GetPayPerEmp = ingtotalpcs * 0.65
End Sub
End Function
Public Function
End Function
did i miss anything else ?
VB Code:
'again, you have a run on line
'not
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency Select Case lngTotalPcs
'but
Public Function GetPayPerEmp (lngTotalPcs As Long) As Currency
THERS SOMETHING WRONG WITH THE PARSING OF THE VBCODE TAGS
I had to insert the comment char ''' just to keep them from running on the same line.
"Select Case" should be on a new line.
But aside from that you have no idea on the poper declaration of procedures... your nesting them in your code. Please read up on procedures, its definition, the types of procedures, etc so you can understand better what I was trying to point out.