accessvbahelp
Technical User
Hello Everyone! How are you doing? I am very new at writing VBA code (first time ever!) Please be patient with me...
I need to create a section in my Private Sub where my approve button will only work when the Revision for each drawing includes "Rev" This is what I have and it is not working.
When the TempRev equals "Rev" I want the code to start from the beginning of the next section which is Line 30. When TempRev does not equal "Rev" I want a message box to appear, and when OK is clicked in the message box I want the code to stop or End Sub, which is line 57.
Now when I click the Approve button, I get a Compile Error: Label not defined and "GoTo 57" is highlighted.
What am I doing wrong? Is there a better way to create this?
Thanks for all of your help!!!
I need to create a section in my Private Sub where my approve button will only work when the Revision for each drawing includes "Rev" This is what I have and it is not working.
Code:
Dim strTempRev As String
Dim strDwgNumb As String
Dim strRev As String
'testing revision contents to verify the approvals are only done on drawings that are under revision
Rev = Forms("frmMain")!Revision.Value 'Gets revision letter from form
TempRev = Right(Rev, 3)
If TempRev = "Rev" Then 'checking that revision contains "rev"
GoTo 30 'will continue through code
Else
MsgBox "This drawing is not under revision please verify the part number, Otherwise see the Engineering Manager."
GoTo 57
Code to continue through the Approve Function is here
(removed to keep the post short, and not to bore you)
End If
End Sub
When the TempRev equals "Rev" I want the code to start from the beginning of the next section which is Line 30. When TempRev does not equal "Rev" I want a message box to appear, and when OK is clicked in the message box I want the code to stop or End Sub, which is line 57.
Now when I click the Approve button, I get a Compile Error: Label not defined and "GoTo 57" is highlighted.
What am I doing wrong? Is there a better way to create this?
Thanks for all of your help!!!