you mean Erase The Select Case statement off the line ?
Compile Error
Expected End of the Line :confused:
Printable View
you mean Erase The Select Case statement off the line ?
Compile Error
Expected End of the Line :confused:
There's a world of difference between erase and move
How Do I Move The select case stement off the line
Compile Error
Expected End of the line :Confused:
Put your curosr under the S of Select and hit the Enter key.Quote:
Originally Posted by Franklin67
and move It where Hmmmm?
Move it nowhere.Quote:
Originally Posted by Franklin67
Just get it off the same line as your Function declaration. If put your cursor under the S in Select and hit enter, you should be just fine.
Are you familiar with the structure of Functions or the structure of Select Case statements?
We're already being patient and trying to explain as best as we could given the fact that your slow on the pickup. But it's not entirely dependent on us.Quote:
Originally Posted by Franklin67
"Help us help you" so to speak.
Like This ?
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency
Select Case lngTotalPcs
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
End Function
what should i do next ?
You got it (except for an extra End Function. You only need one of those. :) )Quote:
Originally Posted by Franklin67
I have no idea what this means, but as far as building your function goes, you don't have to do anything next.Quote:
Originally Posted by Franklin67
I've made a few changes. See the comments
VB Code:
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency Select Case lngTotalPcs case 0 to 200 ' or whatever it should be for the next line GetPayPerEmp = lngTotalPcs * 0.5 Case 200 To 299 ' this should be 399, or you won't get 300-399 GetPayPerEmp = lngTotalPcs * 0.55 Case 400 To 599 GetPayPerEmp = ingtotalpcs * 0.6 Case Is > 599 GetPayPerEmp = ingtotalpcs * 0.65 End select End Function
and thats all what's next
Case 200 To 299 ' this should be 399, or you won't get 300-399
Change the 299 to 399 ?
You don't have to change it. Just add another Case statement to cover for it.
so just add another select case to the next line & The next line .......
Quote:
Originally Posted by Franklin67
VB Code:
Public Function GetPayPerEmp(lngTotalPcs As Long) As Currency Select Case lngTotalPcs case 0 to 200 ' or whatever it should be for the next line GetPayPerEmp = lngTotalPcs * 0.5 Case 200 To 299 ' this should be 399, or you won't get 300-399 GetPayPerEmp = lngTotalPcs * 0.55 Case 300 To 399 'just a new case statement. that is all GetPayPerEmp = lngTotalPcs * whatever Case 400 To 599 GetPayPerEmp = ingtotalpcs * 0.6 Case Is > 599 GetPayPerEmp = ingtotalpcs * 0.65 End Select End Function
how do i do that ?
Add this between 200 and 400, and supply the coreect whatever value.
Unless 300-399 uses the same price as 200-299, in which case you can just change the other statement like I said earlier. If you leave it out, then nothing will be multiplied as a case wouldn't be found
VB Code:
Case 300 To 399 'just a new case statement. that is all GetPayPerEmp = lngTotalPcs * whatever
so what should i add for the new case statement?
Look at post #54
Case 200 To 299 ' this should be 399, or you won't get 300-399
(So this is what i have to type in)
VB Code:
Case 300 To 399 'just a new case statement. GetPayPerEmp = lngTotalPcs 0.55
Yes. Or, you can just copy what I posted and overlay what you have now.Quote:
Originally Posted by Franklin67
so you mean i don't have to change anything except for the 300 and 399
But just leave the 200 alone :confused:
Is the 200 doing what you need it to do?Quote:
Originally Posted by Franklin67
yes i have to use the 200 -399 But Now confused
If the price is the same for 200-399, then you don't have to insert another case statement, you can just change your code from 200-299 to 200-399 and it will work fine.
Jee Thanks Now I got it almost
'to calculate totals use this:VB Code:
Private Sub cmdCalc_Click() 'validate first textbox With Text1 If Not IsNumeric(Trim(.Text)) Then MsgBox "Invalid entry" .SelStart = 0 .SelLength = Len(.Text) .SetFocus Exit Sub End If End With 'validate second textbox With Text2 If Not IsNumeric(Trim(.Text)) Then MsgBox "Invalid entry" .SelStart = 0 .SelLength = Len(.Text) .SetFocus Exit Sub End If End With 'calculate total amount txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00") End Sub 'to clear all of your texboxes use this: Private Sub cmdClear_Click() Dim txt As Control For Each txt In Me.Controls If TypeOf txt Is TextBox Then txt.Text = "" End If Next txt End Sub
so this is what i have to type in to the command button?
Help me i am stuck
Edit: Added [vbcode][/vbcode] tags for clarity. - Hack
Looks OK to me.
VB Code:
what am i surpose to do now ?
double-click on your total button. if it's named the same, it should jump to this line:VB Code:
Private Sub cmdCalc_Click()
if you have it named something else, then copy the code below that line in your example into the sub, but make sure that you only have one END SUB at the bottom. Include the second sub, if you need it. It belongs after the first END SUB. Place OPTION EXPLICIT at the top of each form to catch undeclared variable errors, and if you have anything named correctly it will let you know.
After i do post 66 what should i next?
This isn't our application. How are we to know what you are supposed to do next?
After you calculate the total, what do you/the application need to happen next?
what i ment was after calclulating the totals what should i do ?
My point is, I don't know what you should do because I don't know what your program is supposed to do.Quote:
Originally Posted by Franklin67
What is your program supposed to do after the calculations have been done?
Anything?
VB Code:
'to calculate totals use this: Private Sub cmdCalc_Click() 'validate first textbox With Text1 If Not IsNumeric(Trim(.Text)) Then MsgBox "Invalid entry" .SelStart = 0 .SelLength = Len(.Text) .SetFocus Exit Sub End If End With 'validate second textbox With Text2 If Not IsNumeric(Trim(.Text)) Then MsgBox "Invalid entry" .SelStart = 0 .SelLength = Len(.Text) .SetFocus Exit Sub End If End With 'calculate total amount txtTotal.Text = Format(CCur(Text1.Text) + CCur(Text1.Text), "$0.00") End Sub
Must i add this line to my summary and calculate button?
Or only calculate button?
Do you need a summary total?
Yes i need to have a summary total to
1 To display the Total Number of pieces
2.The Total Pay
3.Average Pay per person
and i need a Clear button to clear the name and the number of pieces for the current employee (If You what I mean)
Based on what you just said, then, the answer is yes.Quote:
Originally Posted by Franklin67
what do i do next?
Why do I get the ever present feeling that the people on this forum are writing this program, not you.
What do you think you should/need to do next?
The people on this forum ARE writing his program for him. the next time he gets some homework, he'll be back with no code of his own. :sick: