User Form question

A

ah

Appreciate if someone could help me with the following:

I've a form that contains a macro to have different Helth Plan selection
list when I select different country from the drop down list. In fact, I've
created multiple fields in the user form now, fr example: ID, Issue Date,
Validity Date, Place of issue and etc.

I managed to get a different ID selection list when I select different
country now. Since some of the ID doesn't have a issue date, I want the form
to capture a value "Not Applicable" by default when I select those ID that
don't have an issue date. Please advice how am I going to get this done?

Belowis the user form in place currently. Please help.

Private Sub UserForm_Initialize()
Dim myArray1() As String 'AUSTRALIA / NEW ZEALAND
Dim myArray2() As String 'BRAZIL
Dim myArray3() As String 'CANADA
Dim myArray4() As String 'CCM
Dim myArray5() As String 'CHINA
Dim myArray6() As String 'FRANCE
Dim myArray7() As String 'GERMANY
Dim myArray8() As String 'HONG KONG
Dim myArray9() As String 'INDIA/SRI LANGKA/BANGLADESH
Dim myArray10() As String 'INDONESIA
Dim myArray11() As String 'JAPAN
Dim myArray12() As String 'KOREA
Dim myArray13() As String 'LACC
Dim myArray14() As String 'MALAYSIA
Dim myArray15() As String 'PHILIPPINES
Dim myArray16() As String 'SINGAPORE
Dim myArray17() As String 'TAIWAN
Dim myArray18() As String 'THAILAND
Dim myArray19() As String 'UNITED KINGDOM
Dim myArray20() As String 'UNITED STATES
Dim myArray21() As String 'VIETNAM

Dim i As Long

myArray1 = Split("Work-Permit(185-4) Passport(185-10)
USA-Social-Security-Number(185-50) USA-Social-Security-Number(185-50) TEST")

Me.ID1.Clear

Select Case ActiveDocument.FormFields("Country_Name").Result
Case "AUSTRALIA / NEW ZEALAND"
Me.ID1.AddItem "Please select one"
Me.ID1.ListIndex = 0
Me.ID1.List = myArray1

End Select

End Sub

Private Sub OK_Click()
ActiveDocument.FormFields("ID1").Result = Me.ID1.Text
ActiveDocument.Bookmarks("ID1").Range.Fields(1).Result.Select

ActiveDocument.FormFields("ID1Acc").Result = Me.ID1Acc.Text
ActiveDocument.Bookmarks("ID1Acc").Range.Fields(1).Result.Select

ActiveDocument.FormFields("ID1DateIssue").Result = Me.ID1DateIssue.Text
ActiveDocument.Bookmarks("ID1DateIssue").Range.Fields(1).Result.Select

ActiveDocument.FormFields("ID1ValidDate").Result = Me.ID1ValidDate.Text
ActiveDocument.Bookmarks("ID1ValidDate").Range.Fields(1).Result.Select

ActiveDocument.FormFields("ID1PlaceOfIssue").Result = Me.ID1PlaceOfIssue.Text
ActiveDocument.Bookmarks("ID1PlaceOfIssue").Range.Fields(1).Result.Select

Unload Me
End Sub
 
I

Ian

At a guess, replace

ActiveDocument.FormFields("ID1DateIssue").Result = Me.ID1DateIssue.Text

with

Select Case Me.ID1.Text
' list of IDs with no issue date
Case "IDtype1", "IDtype2"
ActiveDocument.FormFields("ID1DateIssue").Result = "Not applicable"
' list IDs with issue date
Case "IDtype3", IDtype4" ' list IDs with issue date
ActiveDocument.FormFields("ID1DateIssue").Result =
Me.ID1DateIssue.Text
End Select
 

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