S
Simon Ransom
I am trying to use a tab order macro to move between form fields but with
validation in some cases to check that a value has in fact been updated. I
am receiving the following VB error dialogue when moving out of the fCurrency
field "This Command is not available because no document is open"... this
appears after the MsgBox has been shown... fCurrency and fPaymentTerms are
DropDown List form fields
=================
Sub TabOrder()
Dim StrCurFFld As String, StrFFldToGoTo As String
If Selection.FormFields.Count = 1 Then
StrCurFFld = Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
StrCurFFld = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If
Select Case StrCurFFld
Case "fShippingContactTel"
StrFFldToGoTo = "fOurRef"
Case "fOurRef"
StrFFldToGoTo = "fYourRef"
Case "fYourRef"
StrFFldToGoTo = "fCurrency"
MsgBox "The order total will be displayed automatically once you
have completed this form in full"
Case "fCurrency"
If FormFields("fCurrency").Result = "Currency" Then
MsgBox "Please select the currency from the dropdown list."
StrFFldToGoTo = "fCurrency"
Else
StrFFldToGoTo = "fPaymentTerms"
End If
Case "fPaymentTerms"
If FormFields("fPaymentTerms").Result = "SPECIAL TERMS as below" Then
StrFFldToGoTo = "fSpecialTerms"
Else
StrFFldToGoTo = "fDeliveryTime"
End If
Case "fSpecialTerms"
StrFFldToGoTo = "fDeliveryTime"
Case "fDeliveryTime"
StrFFldToGoTo = "fContractTerms"
End Select
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Result.Select
End Sub
=================
This is driving me nuts so any input will be most appreciated...
Simon
validation in some cases to check that a value has in fact been updated. I
am receiving the following VB error dialogue when moving out of the fCurrency
field "This Command is not available because no document is open"... this
appears after the MsgBox has been shown... fCurrency and fPaymentTerms are
DropDown List form fields
=================
Sub TabOrder()
Dim StrCurFFld As String, StrFFldToGoTo As String
If Selection.FormFields.Count = 1 Then
StrCurFFld = Selection.FormFields(1).Name
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
StrCurFFld = Selection.Bookmarks(Selection.Bookmarks.Count).Name
End If
Select Case StrCurFFld
Case "fShippingContactTel"
StrFFldToGoTo = "fOurRef"
Case "fOurRef"
StrFFldToGoTo = "fYourRef"
Case "fYourRef"
StrFFldToGoTo = "fCurrency"
MsgBox "The order total will be displayed automatically once you
have completed this form in full"
Case "fCurrency"
If FormFields("fCurrency").Result = "Currency" Then
MsgBox "Please select the currency from the dropdown list."
StrFFldToGoTo = "fCurrency"
Else
StrFFldToGoTo = "fPaymentTerms"
End If
Case "fPaymentTerms"
If FormFields("fPaymentTerms").Result = "SPECIAL TERMS as below" Then
StrFFldToGoTo = "fSpecialTerms"
Else
StrFFldToGoTo = "fDeliveryTime"
End If
Case "fSpecialTerms"
StrFFldToGoTo = "fDeliveryTime"
Case "fDeliveryTime"
StrFFldToGoTo = "fContractTerms"
End Select
ActiveDocument.Bookmarks(StrFFldToGoTo).Range.Fields(1).Result.Select
End Sub
=================
This is driving me nuts so any input will be most appreciated...
Simon