Anthony904
IS-IT--Management
Hi,
I have a word97 document that has some form fields. Instead of having users come in and click on each individual formfield to enter data. I created a userform.
This userform has some fields that the users enters in a single data and thats fine. Now I have some fields that require them to enter feet and inches.
These feet and inches calculate into levels. (shown in function levels below) I want the result to be displayed on my form field in my document.
From the code above I'm getting an error:
Compile Error:
Wrong number of arguments or invalid property assignment.
Any ideas?
Thanks!
txtResult form field on document
txtFeet and txtInches are on userform: frmFtNinch
Thanks~!
I have a word97 document that has some form fields. Instead of having users come in and click on each individual formfield to enter data. I created a userform.
This userform has some fields that the users enters in a single data and thats fine. Now I have some fields that require them to enter feet and inches.
These feet and inches calculate into levels. (shown in function levels below) I want the result to be displayed on my form field in my document.
From the code above I'm getting an error:
Compile Error:
Wrong number of arguments or invalid property assignment.
Any ideas?
Thanks!
Code:
Private Sub CommandButton1_Click()
FeetnInches
End Sub
Code:
Function Levels(iLevel As Integer) As Double
Select Case iFeet
Case 0
Select Case iInches
Case 0
Levels = 0
Case 1
Levels = 1
Case 2
Levels = 2
Case 3
Levels = 3
Case 4
Levels = 5
End Select
Case 1
Select Case iInches
Case 0
Levels = 14
Case 1
Levels = 15
Case 2
Levels = 16
Case 3
Levels = 17
Case 4
Levels = 18
End Select
Case 2
Select Case iInches
Case 0
Levels = 28
Case 1
Levels = 29
Case 2
Levels = 30
Case 3
Levels = 31
Case 4
Levels = 32
End Select
Case "" 'Blank formfield
Levels = 0
Case Else ' Other value
Levels = 0
End Select
End Function
Code:
Function FeetnInches()
'Retrieves Feet and Inches from lookup table(above)
On Error GoTo Label
ActiveDocument.FormFields("txtResult").Result = Levels(ActiveDocument.FormFields("txtFeet").Result, ActiveDocument.FormFields("txtInches").Result)
Label:
Resume Next
End Function
txtFeet and txtInches are on userform: frmFtNinch
Thanks~!