Usually when there are efficiency issues the first place I look are loops. You do not have any loops in your code.
On my laptop the form runs fine, but when I place it on the operators computer; it is laggy and slow
I suspect this says more about the operator's computer than your code. Do you know the specs of the computer?
By the way the indentation in this code is a bit eccentric, making it difficult to read. I also recommend you rework your code to get rid of the GoTo statements. That is probably not causing your issue but is a poor coding practice. Here is a rewrite of one of your subs.
Private Sub savecmd_Click2()
'The bottom 4 if statements are to check for blank answers
If TallySheet.carrier.Value = "" Then
Dim carriermsg As VbMsgBoxResult
carriermsg = MsgBox("Enter Carrier Number", vbOKOnly)
Me.carrier.SetFocus
Else
If TallySheet.carrier.Value > 100 Then
carriermsg = MsgBox("Enter Valid Carrier Number", vbOKOnly)
Me.carrier.SetFocus
Else
'Check if color was marked
If Not TallySheet.black.Value And Not TallySheet.ngrey.Value And Not TallySheet.red.Value Then
Dim colormsg As VbMsgBoxResult
colormsg = MsgBox("Select Color", vbOKOnly)
Exit Sub ' instead of exiting sub, shouldn't you continue and check size?
End If
'Check if size was marked
If Not TallySheet.lbr.Value And Not TallySheet.small.Value And Not TallySheet.medium.Value And Not TallySheet.large.Value Then
Dim sizemsg As VbMsgBoxResult
sizemsg = MsgBox("Select Size", vbOKOnly)
Exit Sub
End If
Part:
If TallySheet.partnum.Value = "" Then
Dim partmsg As VbMsgBoxResult
partmsg = MsgBox("Enter Part Number", vbOKOnly)
Me.partnum.SetFocus
' no need to exit sub here, it's the last code that will execute anyway
Else
Dim savemsg As VbMsgBoxResult
savemsg = MsgBox("Information saved.", vbOKOnly)
Call save
Call clear
Me.carrier.SetFocus
End If
End If
End If
End Sub
The Call statement is obsolete and retained for backwards compatibility. It is not required to call a sub. You can just use the name of the sub.
Bookmarks