#1   Report Post  
Posted to microsoft.public.excel.misc
ah ah is offline
external usenet poster
 
Posts: 33
Default User Form question

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).Re sult.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.Fie lds(1).Result.Select

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

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

Unload Me
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ian Ian is offline
external usenet poster
 
Posts: 238
Default User Form question

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

--
Ian
--

"ah" wrote in message
...
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).Re sult.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.Fie lds(1).Result.Select

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

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

Unload Me
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User form Mike Rogers Excel Discussion (Misc queries) 2 March 10th 06 05:56 PM
user form question: text box to display result BigPig Excel Discussion (Misc queries) 0 February 28th 06 12:33 AM
user form question: text box to display result BigPig Excel Worksheet Functions 0 February 25th 06 08:17 PM
Help On User Form mastee Excel Discussion (Misc queries) 4 August 23rd 05 12:31 PM


All times are GMT +1. The time now is 12:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"