message box on entering a form field (1 Viewer)

BarryMK

4 strings are enough
Local time
Today, 01:14
Joined
Oct 15, 2002
Messages
1,350
I'm reasonably competent (ahem) with Access vba but Word is giving me a headache. I know how to add a message box on opening a word doc. The doc has form fields. How do I code for a message box to pop up before or after a field is updated? Thanks
 
Hi Ron

Thanks. Looking at it I'm not sure, it refers to Userforms which I'm not familiar with. Basically I've got a bunch of Word documents with form fields from the Forms toolbox and I need a message box when someone enters data in one of the form fields.

The code below shows what I've got. The first part works fine using Document_Open but the second sub doesn't. I may have written it in the wrong place for all I know!

Code:
Private Sub Document_Open()
   On Error GoTo Document_Open_Error
   MsgBox "Save this blank doc to your own folder before working on it!"
   On Error GoTo 0
   Exit Sub
Document_Open_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Document_Open of Class Module Class1"
End Sub
 
[B]Private Sub Text3_AfterUpdate()[/B]
[B]  MsgBox "What are you doing you idiot?"[/B]
[B]End Sub[/B]

In addition if I type 'Me.' into the code line, it doesn't recognise Text3 as a control.

Cheers
 
Last edited:
Sorted

I found that I had to use a macro not vba to use the on enter function in the form field. PITA but there we are. Cheers
 

Users who are viewing this thread

Back
Top Bottom