jwcolby
jwcolby at colbyconsulting.com
Sun Feb 22 10:14:31 CST 2009
What doesn't work? John W. Colby www.ColbyConsulting.com William Hindman wrote: > ...sigh ...shakes head ...doesn't work ...tries banging head against wall > ...for some reason that only makes it worse :( > > ..."Simple, sweet, and to the point" it ain't, eh ...and telling Drew he's > brilliant is like throwing a cat into a bag full of catnip :( > > ...for this specific case ...translations ...using tags makes a lot more > sense ...imnsho of course. > > ...now WHERE is that damn Tylenol? > > William > > -------------------------------------------------- > From: "jwcolby" <jwcolby at colbyconsulting.com> > Sent: Sunday, February 22, 2009 8:09 AM > To: "Access Developers discussion and problem solving" > <accessd at databaseadvisors.com> > Subject: Re: [AccessD] Find First in an Array? - The Solution > >> Actually I think this solution adds too much burden on the developer. The >> thing is it is the >> computer doing the work and as Rocky said, who cares if the computer is >> unhappy. >> >> Drew's solution was brilliant, rather than stepping through all the >> controls, step through all the >> RECORDS, then use the control name in the record to index into the >> controls collection. >> >> Simple, sweet, and to the point. >> >> As you grab the data, store to a collection and you are done. I did some >> testing however and >> storing to a collection specific to the form is required to keep the >> speeds up. It is at this point >> that the class begins to make sense again. One class for the form, one as >> a supervisor for doing >> this stuff. The class form holds a collection for the strings for the >> specific form, plus all the >> code for loading the data from the recordset. The supervisor has a >> collection to hold the class >> instances for each form plus the code to decide which form is being >> processed. >> >> Simple, sweet, and to the point. >> >> John W. Colby >> www.ColbyConsulting.com >> >> >> Stuart McLachlan wrote: >>> Here's my simple procedural take on the problem. >>> I started thinking about ways to avoid stepping through the whole >>> controls collection for the >>> form and to optimise looping through the ones we are interested in. >>> >>> This method opens a form containing over 200 labels and buttons with no >>> discernable delay. >>> >>> All that is required is that you: >>> a. Maintain a standard naming convention for Labels and Buttons: >>> Label1, Label2 etc and Button1001,Button1002 etc within the form >>> >>> b. Define a FormID constant in each form's module, >>> c. Define constants in each form's module which record the number of >>> labels and buttons >>> d. Store your translation strings with two fields, FormNumber and >>> ControlNumber >>> >>> >>> FormNumber - Long >>> ControlNumber - Long >>> Language1 - String >>> Language 2 - String >>> Language 3 - String >>> etc >>> >>> 1. When the user changes language, load the new one into a Translation >>> collection. >>> In a Module: >>> >>> Global gcolTranslation As New Collection >>> >>> Function GetLanguage(Language as long) >>> Dim rs as DAO Recordset >>> If gcolTranslation.Count > 0 Then >>> For i = 1 To gcolTranslation.Count >>> gcolTranslation.Remove 1 >>> Next >>> End If >>> Set rs = currentdb.openrecordset("uSysTranslationTable") >>> While not rs.eof >>> gcolTranslation.Add rs(Language + 2), _ >>> Format(rs(0),"00") & rs(1) >>> rs.movenext >>> wend >>> rs.close >>> set rs = nothing >>> End Function >>> >>> 2. In each Form create 3 constants: >>> Const FormID As String = "01" >>> Const NoOfLabels As Long = 200 >>> Const NoOfButtons as Long = 5 >>> >>> 3. Use the following on_open event for each form. >>> >>> Private Sub Form_Open(Cancel As Integer) >>> Dim ctl As Control >>> Dim x As Long >>> Dim sX As String >>> For x = 1 To NoOfLabels >>> Me("Label" & x).Caption = gcolTranslation(FormID & x) >>> Next >>> For x = 1001 To 1000 + NoOfButtons >>> Me("Button" & x).Caption = gcolTranslation(FormID & (x) >>> Next >>> End Sub >>> >> -- >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> >