option group help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have an option group with a choice of aingle or joint (clients), if joint
is selected then the relevants fields become visible and are not visible if
single is selected.

however when a choice is made the fields change for the entire records not
just the current record.

can anyone help
 
i have an option group with a choice of aingle or joint (clients), if joint
is selected then the relevants fields become visible and are not visible if
single is selected.

however when a choice is made the fields change for the entire records not
just the current record.

can anyone help

You need to make the Option Control bound to a field in the table.
 
hi fred,

i have the option group bound to a field in the table, i have checked the
table and it has stored the result for each client (either 1 or 2) but still
changes every record to the option selected for the new record.

the code i have written is as follows

Private Sub selectapptype_AfterUpdate()
'enable second applicant fields if user selects joint application.

Const Joint = 2

If Me.selectapptype.Value = Joint Then
Me.Title2.Visible = True
Me.Name_2.Visible = True
Me.Surname2.Visible = True
Me.DOB2.Visible = True
Me.MaritalStatus2.Visible = True
Me.TelHome2.Visible = True
Me.Tel_Work2.Visible = True
Me.Tel_Mobile2.Visible = True
Me.e_mail2.Visible = True
Me.Preferred_Contact2.Visible = True
Me.HouseNumber2.Visible = True
Me.Address2.Visible = True
Me.Locality2.Visible = True
Me.Town2.Visible = True
Me.PostCode2.Visible = True
Me.Married.Visible = True
Me.copyaddress.Visible = True
Me.POID_Reference_Cl2.Visible = True
Me.POID_Type_Cl2.Visible = True
Me.POR_Reference_Cl2.Visible = True
Me.POR_Type_Cl2.Visible = True
Else
Me.Title2.Visible = False
Me.Name_2.Visible = False
Me.Surname2.Visible = False
Me.DOB2.Visible = False
Me.MaritalStatus2.Visible = False
Me.TelHome2.Visible = False
Me.Tel_Work2.Visible = False
Me.Tel_Mobile2.Visible = False
Me.e_mail2.Visible = False
Me.Preferred_Contact2.Visible = False
Me.HouseNumber2.Visible = False
Me.Address2.Visible = False
Me.Locality2.Visible = False
Me.Town2.Visible = False
Me.PostCode2.Visible = False
Me.Married.Visible = False
Me.copyaddress.Visible = False
Me.POID_Reference_Cl2.Visible = False
Me.POID_Type_Cl2.Visible = False
Me.POR_Reference_Cl2.Visible = False
Me.POR_Type_Cl2.Visible = False
End If
End Sub

can you help any further. have i done something wrong ( i am new to access)
 
hi fred,

i have the option group bound to a field in the table, i have checked the
table and it has stored the result for each client (either 1 or 2) but still
changes every record to the option selected for the new record.

the code i have written is as follows

Private Sub selectapptype_AfterUpdate()
'enable second applicant fields if user selects joint application.

Const Joint = 2

If Me.selectapptype.Value = Joint Then
Me.Title2.Visible = True
Me.Name_2.Visible = True
Me.Surname2.Visible = True
Me.DOB2.Visible = True
Me.MaritalStatus2.Visible = True
Me.TelHome2.Visible = True
Me.Tel_Work2.Visible = True
Me.Tel_Mobile2.Visible = True
Me.e_mail2.Visible = True
Me.Preferred_Contact2.Visible = True
Me.HouseNumber2.Visible = True
Me.Address2.Visible = True
Me.Locality2.Visible = True
Me.Town2.Visible = True
Me.PostCode2.Visible = True
Me.Married.Visible = True
Me.copyaddress.Visible = True
Me.POID_Reference_Cl2.Visible = True
Me.POID_Type_Cl2.Visible = True
Me.POR_Reference_Cl2.Visible = True
Me.POR_Type_Cl2.Visible = True
Else
Me.Title2.Visible = False
Me.Name_2.Visible = False
Me.Surname2.Visible = False
Me.DOB2.Visible = False
Me.MaritalStatus2.Visible = False
Me.TelHome2.Visible = False
Me.Tel_Work2.Visible = False
Me.Tel_Mobile2.Visible = False
Me.e_mail2.Visible = False
Me.Preferred_Contact2.Visible = False
Me.HouseNumber2.Visible = False
Me.Address2.Visible = False
Me.Locality2.Visible = False
Me.Town2.Visible = False
Me.PostCode2.Visible = False
Me.Married.Visible = False
Me.copyaddress.Visible = False
Me.POID_Reference_Cl2.Visible = False
Me.POID_Type_Cl2.Visible = False
Me.POR_Reference_Cl2.Visible = False
Me.POR_Type_Cl2.Visible = False
End If
End Sub

can you help any further. have i done something wrong ( i am new to access)

Your code changes those controls when you change the Option Group but
you have no code to change it back if the option value is not 2 when
you navigate to the next record.

In addition to the Option Group AfterUpdate event, place the same code
in the Form Current event.

You can make it a bit easier for yourself by changing the code to
this:

Private Sub selectapptype_AfterUpdate()
Const Joint = 2
Me!Name_2.Visible = Me!selectapptype = Joint
Me.Surname2.Visible =Me!selectapptype = Joint
Me.DOB2.Visible = Me!selectapptype = Joint
' etc. for the others
End Sub

No If .. Then .. Else code is needed.
And do the same in the Form's current event.
 
Back
Top