Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2007

Tip: Looking for answers? Try searching our database.

Update some form fields but not reset others

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SMOO - 17 Jul 2007 19:06 GMT
Good morning,

I have a template with a pop up box...the information entered into the
pop-up box automatically get's put into the form. My problem is...when the
form fields are updated all the other form fields are reset and I lose the
information in them. I of course do not want this to happen. I think the
problem is with the pop-up box code:

Option Explicit

Private Sub cmdCancel_Click()
 Unload Me
End Sub

Private Sub cmdOK_Click()
 ' Prevent variable from being deleted
If txtDate = "" Then txtDate = " "
 ActiveDocument.Variables("Date") = txtDate
 If txtClientName = "" Then txtClientName = " "
 ActiveDocument.Variables("Client Name") = txtClientName
 If txtClientIDNumber = "" Then txtClientIDNumber = " "
 ActiveDocument.Variables("Client ID Number") = txtClientIDNumber
 ' Update fields in document
 
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update
 Unload Me
End Sub

Private Sub txtClientID_Click()

End Sub

Private Sub txtClientIDNumber_Click()

End Sub

Private Sub txtDate_Click()

End Sub

Private Sub Label1_Click()

End Sub

Private Sub UserForm_Initialize()
 ' Load variables into text boxes
 On Error Resume Next
 txtDate = ActiveDocument.Variables("Date")
 txtClientName = ActiveDocument.Variables("Client Name")
 txtClientIDNumber = ActiveDocument.Variables("Client ID Number")
End Sub

How can I tell the code to only update the 3 specific fields without
resetting the whole form?

Thanks,
SMOO
Russ - 18 Jul 2007 10:11 GMT
Are you using the no reset property of Protect?
Below is a quote from VBA Help:

This example protects the active document for forms without resetting the
contents of the form fields.
If ActiveDocument.ProtectionType = wdNoProtection Then
   ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

> Good morning,
>
[quoted text clipped - 53 lines]
> Thanks,
> SMOO

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.