John W. Colby
jwcolby at colbyconsulting.com
Thu Apr 1 10:49:43 CST 2004
And of course, to a man with a hammer... Add this CarryForward() (slightly modified) to the control classes for the controls you want this functionality for, clsTxt if only the text control etc. Then in the dclsFrm form class create a colCarryForward collection to hold pointers to the control classes you want to activate this functionality for. In dclsFrm build a SetCarryForward method with a ParamArray to pass in the controls you want to set this up for. In the form's Open event call dclsFrm.SetCarryForward ctl1, ctl2, ctl3. In SetCarryForward iterate the ParamArray and grab a pointer to the class for each control and place in the colCarryForward collection. In mfrm_BeforeUpdate call a method DoCarryForward() that iterates the colCarryForward collection and calls the control class' CarryForward method. Having done this you now have CarryForward functionality for any form for any project. Just turn it on as you need it by calling the dclsFrm.SetCarryForward method passing in controls to carry forward. Of course you will need a hammer to do this. ;-) John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller Sent: Thursday, April 01, 2004 1:54 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Add new record + fill fields with last entereddata?SOLVED Here is a function that I use for this purpose. It's specific to each particular field on a form, because in my experience I seldom wanted ALL the fields to be duplicated; but rather just many of them. Note that I typically define a compiler directive called TALKON. Public Function CarryForward() Const cQuote = """" 'Thats two quotes Dim ctlCurrent As Control Set ctlCurrent = Screen.ActiveControl ctlCurrent.DefaultValue = cQuote & ctlCurrent.Value & cQuote #If TALKON = True Then Debug.Print "Current default value: " & ctlCurrent.DefaultValue Debug.Print "New default value: " & ctlCurrent.DefaultValue #End If Set ctlCurrent = Nothing End Function Arthur -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of S D Sent: Thursday, April 01, 2004 3:59 AM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Add new record + fill fields with last entered data?SOLVED We're doing mostly 'maintenace' (don't know the English word for this) for over 100 apps...not counting Excel -'tjoep' :-) Stuart McLachlan <stuart at lexacorp.com.pg> wrote:On 1 Apr 2004 at 2:23, S D wrote: > Hi Gustav, > Coffee? Plenty! > Tough day...oi! > > MS-Development team of 5, 4 people are ill....guess who's not.... ;-) > You're lucky. MS Development team of one. Coughing, sneezing, aching muscles, high temperature and deadlines looming on a couple of projects :-( -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com