Hi
I have a question regarding how to apply the same sub procedure such as the following example to multiple controls on the same form. I want to apply this procedure to Copy2, Copy3, Copy4... Copy10. Is there a way to pass the Copy# as a variable? So for each Copy#, before updating I want it to run the same procedure below. Is this possible to do without separately coding an individual BeforeUpdate procedure for every single Copy#?
Any advice is greatly appreciated!!!
-----------------------------------
Private Sub Copy1_BeforeUpdate(Cancel As Integer)
If Me!Copy1 Like "*[[]LINK]*" Then
If Len(Me!Copy1) < 1020 Then
Exit Sub
Else: MsgBox "You are limited to 1024 characters in the copy of each block. You currently have " & Len(Me!Copy1) & ". Please remove any excess characters.", vbExclamation, "Character Limit"
Me.Undo
End If
Else: Response = MsgBox("You must type [LINK] where Link Text should appear." & Chr(13) & "Do you want to add a link?", vbYesNo, "[LINK] Error")
If Response = vbYes Then
Me.Undo
End If
End If
End Sub
---------------------------------
-Lu
I have a question regarding how to apply the same sub procedure such as the following example to multiple controls on the same form. I want to apply this procedure to Copy2, Copy3, Copy4... Copy10. Is there a way to pass the Copy# as a variable? So for each Copy#, before updating I want it to run the same procedure below. Is this possible to do without separately coding an individual BeforeUpdate procedure for every single Copy#?
Any advice is greatly appreciated!!!
-----------------------------------
Private Sub Copy1_BeforeUpdate(Cancel As Integer)
If Me!Copy1 Like "*[[]LINK]*" Then
If Len(Me!Copy1) < 1020 Then
Exit Sub
Else: MsgBox "You are limited to 1024 characters in the copy of each block. You currently have " & Len(Me!Copy1) & ". Please remove any excess characters.", vbExclamation, "Character Limit"
Me.Undo
End If
Else: Response = MsgBox("You must type [LINK] where Link Text should appear." & Chr(13) & "Do you want to add a link?", vbYesNo, "[LINK] Error")
If Response = vbYes Then
Me.Undo
End If
End If
End Sub
---------------------------------
-Lu