Turning code off?

Johnrg

Registered User.
Local time
Tomorrow, 02:24
Joined
Sep 25, 2008
Messages
115
Guys,

I have the following code in a subform that I want to turnoff (make invisible) so that each time I change data in its related feild its does not do a record change.
I don't want to deleate it, just get access to miss running it.
How do I do this?


Private Sub CurrencyType_AfterUpdate()
Call RecordChange

End Sub
Private Sub Drying_AfterUpdate()
Call RecordChange

End Sub
Private Sub Finish_AfterUpdate()
Call RecordChange

End Sub
 
Put a single quote mark at the start of the lines you don't want to run.
This makes the line into a comment.

You can also use it to start comments after the code on a line.
 
To expand on the previous answer, when you have "Rem'd" (remarked) out a line of code it will display in the code builder as green to indicate that it will be treated as a Remark rather than active code. So for example you code would look something like

Code:
Private Sub CurrencyType_AfterUpdate()
[COLOR="SeaGreen"]'Call RecordChange

'End Sub
'Private Sub Drying_AfterUpdate()
'Call RecordChange[/COLOR]

End Sub
Private Sub Finish_AfterUpdate()
Call RecordChange

End Sub
 
if want to keep it active but under conditions .. use the If statement and in the Elese part use Exit Sub
Ex:
Code:
Private Sub Finish_AfterUpdate()
If Me.UserName = "Admin" Then
 
    Call RecordChange
Else
  Exit Sub
End If
End Sub
Where UserName is a control "Text, Combo,,,,etc"
HAMMAM
 

Users who are viewing this thread

Back
Top Bottom