Update some fields but not reset others

S

SMOO

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top