Technyc2003
IS-IT--Management
I've created a template form for my co-workers to be able to fill out easier by using VBA. The textfields work ok it's just the checkboxes. The form is also protected from the little lock on the forms toolbar. I created an OK command button so once they fill out all the boxes and text boxes it will insert the info into the form. Here's the code for the OK command button.
I have 4 check boxes that are not placed in tables. They are:
1) New Admission
2) Referral
3) Transfer
4) Discharged
I also named the Bookmarks for each checkbox according to those names.
------------------------------------
Private Sub CmdOK_Click()
' Unprotect doc to enter patient data
Call pToggleProtectDoc
Application.ScreenUpdating = False
With ActiveDocument
If NewAdmission = True Then
ActiveDocument.Bookmarks("NewAdmission").Result = True
' I get an error message on the .Result when I run this macro.
.Bookmarks("txtPatientName").Range.Text = txtPatientName.Value
.Bookmarks("txtPickup").Range.Text = txtPickup.Value
.Bookmarks("txtDosage").Range.Text = txtDosage.Value
.Bookmarks("txtIncDecDate").Range.Text = txtIncDecDate.Value
.Bookmarks("txtIDNO").Range.Text = txtIDNO.Value
.Bookmarks("txtDOA").Range.Text = txtDOA.Value
.Bookmarks("txtDatePrep").Range.Text = txtDatePrep.Value
End With
Application.ScreenUpdating = True
' Additional option code snippet
Call pToggleProtectDoc
' gets rid of this form
UserForm1.Hide
Unload Me
End Sub
-----------------------------------
Please any help is greatly appreciated. I've been stuck on this for a few days now.
Note: I'm using the checkboxes from the Forms toolbar because this is a complex form and am utilizing table designs for other checkboxes I have in place.
I cannot utilized the checkbox from the control toolbox since it distored my form's layout.
---------------------------------
I have 4 check boxes that are not placed in tables. They are:
1) New Admission
2) Referral
3) Transfer
4) Discharged
I also named the Bookmarks for each checkbox according to those names.
------------------------------------
Private Sub CmdOK_Click()
' Unprotect doc to enter patient data
Call pToggleProtectDoc
Application.ScreenUpdating = False
With ActiveDocument
If NewAdmission = True Then
ActiveDocument.Bookmarks("NewAdmission").Result = True
' I get an error message on the .Result when I run this macro.
.Bookmarks("txtPatientName").Range.Text = txtPatientName.Value
.Bookmarks("txtPickup").Range.Text = txtPickup.Value
.Bookmarks("txtDosage").Range.Text = txtDosage.Value
.Bookmarks("txtIncDecDate").Range.Text = txtIncDecDate.Value
.Bookmarks("txtIDNO").Range.Text = txtIDNO.Value
.Bookmarks("txtDOA").Range.Text = txtDOA.Value
.Bookmarks("txtDatePrep").Range.Text = txtDatePrep.Value
End With
Application.ScreenUpdating = True
' Additional option code snippet
Call pToggleProtectDoc
' gets rid of this form
UserForm1.Hide
Unload Me
End Sub
-----------------------------------
Please any help is greatly appreciated. I've been stuck on this for a few days now.
Note: I'm using the checkboxes from the Forms toolbar because this is a complex form and am utilizing table designs for other checkboxes I have in place.
I cannot utilized the checkbox from the control toolbox since it distored my form's layout.
---------------------------------