Kath Pelletti
kp at sdsonline.net
Tue Mar 11 17:26:44 CDT 2008
Thanks Max. Much simpler. Kath ----- Original Message ----- From: "Max Wanadoo" <max.wanadoo at gmail.com> To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Sent: Tuesday, March 11, 2008 9:50 PM Subject: Re: [AccessD] TabControlSheet Page Event? > Hi Kath, > As an aside, you can change this: > > If Me.Dirty Then > DoCmd.RunCommand acCmdSaveRecord > End If > > to this: > > me.dirty = false > > It does the same thing without having to do a check first or invoking > another function. all happens within the Form. > > Max > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kath Pelletti > Sent: Tuesday, March 11, 2008 5:00 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] TabControlSheet Page Event? > > Darryl - you need the tab control's 'On Change' event. For each 'tab' on > the > tab control, the tabs have a value starting from 0 (ie. the first tab is > 0, > the second is 1 etc). So then you can say if on the first tab, load > subform > a, if on 2nd tab, load subform b etc. > > My code looks something like this: > '---------------------------------------------------------- > Private Sub TabChosen_Change() > Dim strerrormsg As String > On Error GoTo Err_Handler > > If Me.Dirty Then > DoCmd.RunCommand acCmdSaveRecord > End If > > If Me.TabChosen.Value = 1 Then 'On borrowers subform. > 'If subform not loaded then load it. > If IsNull(Me.FrmClientContractPrincipalSecuritiesSubform.SourceObject) > Or _ > Me.FrmClientContractPrincipalSecuritiesSubform.SourceObject = "" Then > Me.FrmClientContractPrincipalSecuritiesSubform.SourceObject = > "FrmClientContractPrincipalSecuritiesSubform" > End If > Me.FrmClientContractPrincipalSecuritiesSubform![OfferedBy].Requery > > ElseIf Me.TabChosen.Value = 2 Then 'On Collateral securities > subform. > 'If subform not loaded then load it. > If IsNull(Me.FrmClientContractCollateralSecuritiesSubform.SourceObject) > Or _ > Me.FrmClientContractCollateralSecuritiesSubform.SourceObject = "" Then > Me.FrmClientContractCollateralSecuritiesSubform.SourceObject = > "FrmClientContractCollateralSecuritiesSubform" > End If > > ElseIf Me.TabChosen.Value = 3 Then 'On IPF data tab subform > If IsNull(Me.FrmClientContractIPFData.SourceObject) Or _ > Me.FrmClientContractIPFData.SourceObject = "" Then > Me.FrmClientContractIPFData.SourceObject = > "FrmClientContractIPFData" > End If > > End If > > Normal_exit: > Application.Echo True > Exit Sub > Err_Handler: > MsgBox "Error: [" & Err.Number & "] " & IIf(Len(strerrormsg) > 0, > strerrormsg, Err.Description), vbCritical, "Error Message" > Resume Normal_exit > End Sub > > '---------------------------------------------------------- > > Kath > > ----- Original Message ----- > From: "Darryl Collins" <Darryl.Collins at coles.com.au> > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > Sent: Tuesday, March 11, 2008 3:24 PM > Subject: [AccessD] TabControlSheet Page Event? > > >> Hey all, >> >> I am stuck on with this, It is probably easy but been up since 4am (it is >> now 3:20pm) so I am not the sharpest tool in the shed right now! >> >> I have a form with sheet tabs, currently when a user opens the form it is >> populating all the tabs with data, but this seems a lot of overhead as >> some users will only look at one or two of the Tab pages. I wanted to >> capture when a user click on the tab page so I can call some VBA that >> will > >> load the sub forms for that page only. I have the code to populate the >> sheet tabs etc, but I cannot seem to capture the "click on page tab" >> event > >> at all. >> >> I can get "Click on TabControlSheet" but that is for the whole sheet >> and/or other such unhelpful combos of events. I thought this would be >> simple, but maybe I am wrong? >> >> >> '------------------------------------------------ >> ' Something like: >> >> Private Sub TabControlSheet.Pages(2)_Click() >> >> ' Then call the modules I want >> >> End sub >> '------------------------------------------------ >> >> would be great, but that doesn't seem to be an option. >> >> Any advice? >> >> cheers >> >> Darryl. >> >> This email and any attachments may contain privileged and confidential >> information and are intended for the named addressee only. If you have >> received this e-mail in error, please notify the sender and delete this >> e-mail immediately. Any confidentiality, privilege or copyright is not >> waived or lost because this e-mail has been sent to you in error. It is >> your responsibility to check this e-mail and any attachments for viruses. >> No warranty is made that this material is free from computer virus or any >> other defect or error. Any loss/damage incurred by using this material >> is > >> not the sender's responsibility. The sender's entire liability will be >> limited to resupplying the material. >> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com