Blackwidow
Registered User.
- Local time
- Today, 18:48
- Joined
- Apr 30, 2003
- Messages
- 149
Please can someone help me after keying in all the programming to get the buttons to become visible as I need them, it is now coming up with an error that the procedure is too large! Is there anyway at all of simplifying my code. basically on selection from the combo box three text boxes and a label becomes visible and all the rest are hidden. I know the code works i just have too many subjects!
Tearing my hair out here
'Show English and English Literature only
If ([Subject] = "EN") Then
lblEn.Visible = True
txtenc.Visible = True
txtent.Visible = True
txtene.Visible = True
LBLENL.Visible = True
txtENLC.Visible = True
TXTENLT.Visible = True
TXTENLE.Visible = True
LBLASD.Visible = False
TXTASDC.Visible = False
TXTASDT.Visible = False
TXTASDE.Visible = False
LBLAMP.Visible = False
TXTAMPC.Visible = False
TXTAMPT.Visible = False
TXTAMPE.Visible = False
lblamr.Visible = False
txtamrc.Visible = False
txtamrt.Visible = False
txtamre.Visible = False
lblAr.Visible = False
txtarc.Visible = False
txtart.Visible = False
txtArE.Visible = False
LBLBTHS.Visible = False
TXTBTHSC.Visible = False
TXTBTHST.Visible = False
TXTBTHSE.Visible = False
lblbs.Visible = False
txtbsc.Visible = False
txtbst.Visible = False
txtbse.Visible = False
lblcd.Visible = False
txtcdc.Visible = False
txtcdt.Visible = False
txtcde.Visible = False
lblDA.Visible = False
txtDAC.Visible = False
txtDAT.Visible = False
txtDAE.Visible = False
LBLAA.Visible = False
TXTAAC.Visible = False
TXTAAT.Visible = False
TXTAAE.Visible = False
lbldr.Visible = False
TXTDRC.Visible = False
txtdrt.Visible = False
txtdre.Visible = False
lblea.Visible = False
txteac.Visible = False
txteat.Visible = False
txteae.Visible = False
lblfd.Visible = False
txtfdc.Visible = False
txtfdt.Visible = False
txtfde.Visible = False
LblFr.Visible = False
TxtFrc.Visible = False
Txtfrt.Visible = False
txtfre.Visible = False
lblgg.Visible = False
txtggc.Visible = False
txtggt.Visible = False
txtgge.Visible = False
lblgh.Visible = False
txtghc.Visible = False
txtght.Visible = False
txtghe.Visible = False
lblGI.Visible = False
TxtGIC.Visible = False
TxtGIT.Visible = False
TxtGIE.Visible = False
LBLGR.Visible = False
TXTGRC.Visible = False
TXTGRT.Visible = False
TXTGRE.Visible = False
lblhi.Visible = False
txthic.Visible = False
txthit.Visible = False
txthie.Visible = False
LBLIT.Visible = False
TXTITC.Visible = False
TXTITT.Visible = False
TXTITE.Visible = False
lblLw.Visible = False
TxtLWC.Visible = False
TxtLWT.Visible = False
TxtLWE.Visible = False
lblma.Visible = False
txtmac.Visible = False
txtmat.Visible = False
txtmae.Visible = False
LBLMD.Visible = False
TXTMDC.Visible = False
TXTMDT.Visible = False
TXTMDE.Visible = False
lblmu.Visible = False
txtmuc.Visible = False
txtmut.Visible = False
txtmue.Visible = False
lblPE.Visible = False
TxtPEC.Visible = False
TxtPET.Visible = False
TxtPEE.Visible = False
lblsc.Visible = False
txtscc.Visible = False
txtsct.Visible = False
txtsce.Visible = False
LBLSP.Visible = False
TXTSPC.Visible = False
TXTSPT.Visible = False
TXTSPE.Visible = False
LBLTE.Visible = False
TXTTEC.Visible = False
TXTTET.Visible = False
TXTTEE.Visible = False
'Show ASD only
If ([Subject] = "ASD") Then
lblEn.Visible = False
txtenc.Visible = False
txtent.Visible = False
txtene.Visible = False
LBLENL.Visible = False
txtENLC.Visible = False
TXTENLT.Visible = False
TXTENLE.Visible = False
LBLASD.Visible = True
TXTASDC.Visible = True
TXTASDT.Visible = True
TXTASDE.Visible = True
LBLAMP.Visible = False
TXTAMPC.Visible = False
TXTAMPT.Visible = False
TXTAMPE.Visible = False
lblamr.Visible = False
txtamrc.Visible = False
txtamrt.Visible = False
txtamre.Visible = False
lblAr.Visible = False
txtarc.Visible = False
txtart.Visible = False
txtArE.Visible = False
LBLBTHS.Visible = False
TXTBTHSC.Visible = False
TXTBTHST.Visible = False
TXTBTHSE.Visible = False
lblbs.Visible = False
txtbsc.Visible = False
txtbst.Visible = False
txtbse.Visible = False
lblcd.Visible = False
txtcdc.Visible = False
txtcdt.Visible = False
txtcde.Visible = False
lblDA.Visible = False
txtDAC.Visible = False
txtDAT.Visible = False
txtDAE.Visible = False
LBLAA.Visible = False
TXTAAC.Visible = False
TXTAAT.Visible = False
TXTAAE.Visible = False
lbldr.Visible = False
TXTDRC.Visible = False
txtdrt.Visible = False
txtdre.Visible = False
lblea.Visible = False
txteac.Visible = False
txteat.Visible = False
txteae.Visible = False
lblfd.Visible = False
txtfdc.Visible = False
txtfdt.Visible = False
txtfde.Visible = False
LblFr.Visible = False
TxtFrc.Visible = False
Txtfrt.Visible = False
txtfre.Visible = False
lblgg.Visible = False
txtggc.Visible = False
txtggt.Visible = False
txtgge.Visible = False
lblgh.Visible = False
txtghc.Visible = False
txtght.Visible = False
txtghe.Visible = False
lblGI.Visible = False
TxtGIC.Visible = False
TxtGIT.Visible = False
TxtGIE.Visible = False
LBLGR.Visible = False
TXTGRC.Visible = False
TXTGRT.Visible = False
TXTGRE.Visible = False
lblhi.Visible = False
txthic.Visible = False
txthit.Visible = False
txthie.Visible = False
LBLIT.Visible = False
TXTITC.Visible = False
TXTITT.Visible = False
TXTITE.Visible = False
lblLw.Visible = False
TxtLWC.Visible = False
TxtLWT.Visible = False
TxtLWE.Visible = False
lblma.Visible = False
txtmac.Visible = False
txtmat.Visible = False
txtmae.Visible = False
LBLMD.Visible = False
TXTMDC.Visible = False
TXTMDT.Visible = False
TXTMDE.Visible = False
lblmu.Visible = False
txtmuc.Visible = False
txtmut.Visible = False
txtmue.Visible = False
lblPE.Visible = False
TxtPEC.Visible = False
TxtPET.Visible = False
TxtPEE.Visible = False
lblsc.Visible = False
txtscc.Visible = False
txtsct.Visible = False
txtsce.Visible = False
LBLSP.Visible = False
TXTSPC.Visible = False
TXTSPT.Visible = False
TXTSPE.Visible = False
LBLTE.Visible = False
TXTTEC.Visible = False
TXTTET.Visible = False
TXTTEE.Visible = False
End If
End If
End Sub
(Arrghhh its too big to paste as well! have narrowed it down to two subjects is there anyway this can be simplified?)
Tearing my hair out here
'Show English and English Literature only
If ([Subject] = "EN") Then
lblEn.Visible = True
txtenc.Visible = True
txtent.Visible = True
txtene.Visible = True
LBLENL.Visible = True
txtENLC.Visible = True
TXTENLT.Visible = True
TXTENLE.Visible = True
LBLASD.Visible = False
TXTASDC.Visible = False
TXTASDT.Visible = False
TXTASDE.Visible = False
LBLAMP.Visible = False
TXTAMPC.Visible = False
TXTAMPT.Visible = False
TXTAMPE.Visible = False
lblamr.Visible = False
txtamrc.Visible = False
txtamrt.Visible = False
txtamre.Visible = False
lblAr.Visible = False
txtarc.Visible = False
txtart.Visible = False
txtArE.Visible = False
LBLBTHS.Visible = False
TXTBTHSC.Visible = False
TXTBTHST.Visible = False
TXTBTHSE.Visible = False
lblbs.Visible = False
txtbsc.Visible = False
txtbst.Visible = False
txtbse.Visible = False
lblcd.Visible = False
txtcdc.Visible = False
txtcdt.Visible = False
txtcde.Visible = False
lblDA.Visible = False
txtDAC.Visible = False
txtDAT.Visible = False
txtDAE.Visible = False
LBLAA.Visible = False
TXTAAC.Visible = False
TXTAAT.Visible = False
TXTAAE.Visible = False
lbldr.Visible = False
TXTDRC.Visible = False
txtdrt.Visible = False
txtdre.Visible = False
lblea.Visible = False
txteac.Visible = False
txteat.Visible = False
txteae.Visible = False
lblfd.Visible = False
txtfdc.Visible = False
txtfdt.Visible = False
txtfde.Visible = False
LblFr.Visible = False
TxtFrc.Visible = False
Txtfrt.Visible = False
txtfre.Visible = False
lblgg.Visible = False
txtggc.Visible = False
txtggt.Visible = False
txtgge.Visible = False
lblgh.Visible = False
txtghc.Visible = False
txtght.Visible = False
txtghe.Visible = False
lblGI.Visible = False
TxtGIC.Visible = False
TxtGIT.Visible = False
TxtGIE.Visible = False
LBLGR.Visible = False
TXTGRC.Visible = False
TXTGRT.Visible = False
TXTGRE.Visible = False
lblhi.Visible = False
txthic.Visible = False
txthit.Visible = False
txthie.Visible = False
LBLIT.Visible = False
TXTITC.Visible = False
TXTITT.Visible = False
TXTITE.Visible = False
lblLw.Visible = False
TxtLWC.Visible = False
TxtLWT.Visible = False
TxtLWE.Visible = False
lblma.Visible = False
txtmac.Visible = False
txtmat.Visible = False
txtmae.Visible = False
LBLMD.Visible = False
TXTMDC.Visible = False
TXTMDT.Visible = False
TXTMDE.Visible = False
lblmu.Visible = False
txtmuc.Visible = False
txtmut.Visible = False
txtmue.Visible = False
lblPE.Visible = False
TxtPEC.Visible = False
TxtPET.Visible = False
TxtPEE.Visible = False
lblsc.Visible = False
txtscc.Visible = False
txtsct.Visible = False
txtsce.Visible = False
LBLSP.Visible = False
TXTSPC.Visible = False
TXTSPT.Visible = False
TXTSPE.Visible = False
LBLTE.Visible = False
TXTTEC.Visible = False
TXTTET.Visible = False
TXTTEE.Visible = False
'Show ASD only
If ([Subject] = "ASD") Then
lblEn.Visible = False
txtenc.Visible = False
txtent.Visible = False
txtene.Visible = False
LBLENL.Visible = False
txtENLC.Visible = False
TXTENLT.Visible = False
TXTENLE.Visible = False
LBLASD.Visible = True
TXTASDC.Visible = True
TXTASDT.Visible = True
TXTASDE.Visible = True
LBLAMP.Visible = False
TXTAMPC.Visible = False
TXTAMPT.Visible = False
TXTAMPE.Visible = False
lblamr.Visible = False
txtamrc.Visible = False
txtamrt.Visible = False
txtamre.Visible = False
lblAr.Visible = False
txtarc.Visible = False
txtart.Visible = False
txtArE.Visible = False
LBLBTHS.Visible = False
TXTBTHSC.Visible = False
TXTBTHST.Visible = False
TXTBTHSE.Visible = False
lblbs.Visible = False
txtbsc.Visible = False
txtbst.Visible = False
txtbse.Visible = False
lblcd.Visible = False
txtcdc.Visible = False
txtcdt.Visible = False
txtcde.Visible = False
lblDA.Visible = False
txtDAC.Visible = False
txtDAT.Visible = False
txtDAE.Visible = False
LBLAA.Visible = False
TXTAAC.Visible = False
TXTAAT.Visible = False
TXTAAE.Visible = False
lbldr.Visible = False
TXTDRC.Visible = False
txtdrt.Visible = False
txtdre.Visible = False
lblea.Visible = False
txteac.Visible = False
txteat.Visible = False
txteae.Visible = False
lblfd.Visible = False
txtfdc.Visible = False
txtfdt.Visible = False
txtfde.Visible = False
LblFr.Visible = False
TxtFrc.Visible = False
Txtfrt.Visible = False
txtfre.Visible = False
lblgg.Visible = False
txtggc.Visible = False
txtggt.Visible = False
txtgge.Visible = False
lblgh.Visible = False
txtghc.Visible = False
txtght.Visible = False
txtghe.Visible = False
lblGI.Visible = False
TxtGIC.Visible = False
TxtGIT.Visible = False
TxtGIE.Visible = False
LBLGR.Visible = False
TXTGRC.Visible = False
TXTGRT.Visible = False
TXTGRE.Visible = False
lblhi.Visible = False
txthic.Visible = False
txthit.Visible = False
txthie.Visible = False
LBLIT.Visible = False
TXTITC.Visible = False
TXTITT.Visible = False
TXTITE.Visible = False
lblLw.Visible = False
TxtLWC.Visible = False
TxtLWT.Visible = False
TxtLWE.Visible = False
lblma.Visible = False
txtmac.Visible = False
txtmat.Visible = False
txtmae.Visible = False
LBLMD.Visible = False
TXTMDC.Visible = False
TXTMDT.Visible = False
TXTMDE.Visible = False
lblmu.Visible = False
txtmuc.Visible = False
txtmut.Visible = False
txtmue.Visible = False
lblPE.Visible = False
TxtPEC.Visible = False
TxtPET.Visible = False
TxtPEE.Visible = False
lblsc.Visible = False
txtscc.Visible = False
txtsct.Visible = False
txtsce.Visible = False
LBLSP.Visible = False
TXTSPC.Visible = False
TXTSPT.Visible = False
TXTSPE.Visible = False
LBLTE.Visible = False
TXTTEC.Visible = False
TXTTET.Visible = False
TXTTEE.Visible = False
End If
End If
End Sub
(Arrghhh its too big to paste as well! have narrowed it down to two subjects is there anyway this can be simplified?)