G
GregJG
I have an add button on a form, that when clicked has the followin
procedure.
Private Sub cmdAdd_Click()
Dim myval1 As Integer
Dim myval2 As Integer
If labT01.Caption = "" Then
labT01.Caption = txtTrip.Value
labEDWA01.Caption = txtWA.Value
labEDFlr01.Caption = txtFlr.Value
labEDHght01.Caption = txtHght.Value
labEDMat01.Caption = txtMat.Value
labEDSF01.Caption = txtSF.Value
labEDNotes01.Caption = txtNotes.Value
myval1 = labEDHght01.Caption
myval2 = labEDFlr01.Caption
labMCPSF01.Caption
Format(Application.WorksheetFunction.VLookup(labEDMat01.Caption
Workbooks("bidditdb.xls").Sheets("mat").Range("a1:j200"), 10, False)
"0.00")
labMCT01.Caption = Format(labMCPSF01.Caption * labEDSF01.Caption
"0.00")
labLCPSF01.Caption
Format(Application.WorksheetFunction.VLookup(myval2
Workbooks("BiddItDB.xls").Sheets("xl").Range("a1:b30"), 2, False)
Application.WorksheetFunction.VLookup(myval1
Workbooks("BiddItDB.xls").Sheets("xl").Range("a1:b30"), 2, False)
Application.WorksheetFunction.VLookup(labEDMat01.Caption
Workbooks("bidditdb.xls").Sheets("mat").Range("a1:e200"), 5, False)
"0.00")
labLCT01.Caption = Format(labLCPSF01.Caption * labEDSF01.Caption
"0.00")
labTC01.Caption
FormatCurrency(Application.WorksheetFunction.Sum(labLCT01.Caption
labMCT01.Caption), 2, vbUseDefault, vbUseDefault, vbUseDefault)
Else
If labT02.Caption = "" Then
'repeats the above, with 01 changed to 02 before each .caption
problem is, there are a total of 60 If's which causes error "procedur
is too large". I have read on microsoft, that the solution is to spli
the procedure into smaller ones. but not sure how that is done.
any advise
procedure.
Private Sub cmdAdd_Click()
Dim myval1 As Integer
Dim myval2 As Integer
If labT01.Caption = "" Then
labT01.Caption = txtTrip.Value
labEDWA01.Caption = txtWA.Value
labEDFlr01.Caption = txtFlr.Value
labEDHght01.Caption = txtHght.Value
labEDMat01.Caption = txtMat.Value
labEDSF01.Caption = txtSF.Value
labEDNotes01.Caption = txtNotes.Value
myval1 = labEDHght01.Caption
myval2 = labEDFlr01.Caption
labMCPSF01.Caption
Format(Application.WorksheetFunction.VLookup(labEDMat01.Caption
Workbooks("bidditdb.xls").Sheets("mat").Range("a1:j200"), 10, False)
"0.00")
labMCT01.Caption = Format(labMCPSF01.Caption * labEDSF01.Caption
"0.00")
labLCPSF01.Caption
Format(Application.WorksheetFunction.VLookup(myval2
Workbooks("BiddItDB.xls").Sheets("xl").Range("a1:b30"), 2, False)
Application.WorksheetFunction.VLookup(myval1
Workbooks("BiddItDB.xls").Sheets("xl").Range("a1:b30"), 2, False)
Application.WorksheetFunction.VLookup(labEDMat01.Caption
Workbooks("bidditdb.xls").Sheets("mat").Range("a1:e200"), 5, False)
"0.00")
labLCT01.Caption = Format(labLCPSF01.Caption * labEDSF01.Caption
"0.00")
labTC01.Caption
FormatCurrency(Application.WorksheetFunction.Sum(labLCT01.Caption
labMCT01.Caption), 2, vbUseDefault, vbUseDefault, vbUseDefault)
Else
If labT02.Caption = "" Then
'repeats the above, with 01 changed to 02 before each .caption
problem is, there are a total of 60 If's which causes error "procedur
is too large". I have read on microsoft, that the solution is to spli
the procedure into smaller ones. but not sure how that is done.
any advise