jwcolby
jwcolby at colbyconsulting.com
Sun Feb 8 16:18:41 CST 2009
A combo class. A form class that scans for combos (as a starter) and loads a class instance for each combo found. The combo class sinks the before update (I think) of the combo and loads the old value into a class local variable. The combo class has the code to do whatever "lookup" you want to do. Having this allows you to simply load the form class in any form that you want to do this in. The form class loads combo classes automatically. The combo classes handle the rest, automatically. John W. Colby www.ColbyConsulting.com Stuart McLachlan wrote: > Hi Max, see comments in line. > > On 8 Feb 2009 at 9:59, Max Wanadoo wrote: > >> Hi Stuart (or G'day PNG) >> >> The reason you are probably getting "6" instead of "Description" is probably >> because the Index is pointing to position 1 instead of position 0. Most >> people would probably have the rowsource set to "Select ID, Descr from >> tblLookup", so to get at "Description" at position 0 you could try >> fldname.column(0) . >> > > No, I know *why* I'm getting it. > > All the comboboxes look something like this (just replace "FundingSource" with the relevant > name for about 20 other lookups on the form) > > Name = cboFundingSourceFK > ControlSource = FundingSourceFK > RowSource = Select FundingSourceDescr,FundingSourceID From tblFundingSources) > ColumnCount = 2 > Bound Column = 2 > ColumnWidth = 4,0 > > ctl.Value and ctl.Oldvalue return the FK ( a number) > In the Diary I want to log the Description associated with that FK. > >> I would also change the variable to a variant, ie strchanges to varchanges >> so that it handles nulls etc. > > I wouldn't - I always type my variables! NZ() handles Nulls and gives me better control over > the return value from a Null. (e.g. NZ(ctl.Value, "BLANK") below) > >> I would also have a look at storing the control.value onentry then onexit do >> a "me.dirty=false" forcing a save and then checking contol.value again and >> if different writing it away by calling a function. >> > > I'm trying to avoid doing anything in individual controls event procedures - it's much cleaner > to do it all in one generic function in the Form Before_update. >