[AccessD] Tags are so 1990s - was Re: Combobox.oldvalue display text?

Max Wanadoo max.wanadoo at gmail.com
Mon Feb 9 09:50:27 CST 2009


Ha!  It was in the 1990's I wrote it <g>.  I dont use tags now, but they
might be useful for some purposes - I can think of one but won't go into
that now.

The aim was to demonstrate easily, the use of control looping with the
various control types and not the storage of variable values.

I also use classes but I am not a devotee like you John.  Sinking and Uping
(or whatever the reverse of sinking is) or WithEvents is not something I
have ever got into and have never ever had a need for this - I say that
because I have not come across anything that I cannot do without using
it/them.

I would be interest to follow a thread though.

Thanks
Max


On Mon, Feb 9, 2009 at 3:39 PM, <krosenstiel at comcast.net> wrote:

> I'd be interested in this. Doubt I'll understand it, but I'd be interested.
>
> Karen Rosenstiel
> Seattle WA USA
>
> ----- Original Message -----
> From: "jwcolby" <jwcolby at colbyconsulting.com>
> To: "Access Developers discussion and problem solving" <
> accessd at databaseadvisors.com>
> Sent: Monday, February 9, 2009 6:12:52 AM GMT -08:00 US/Canada Pacific
> Subject: [AccessD] Tags are so 1990s - was Re: Combobox.oldvalue display
> text?
>
> Guys,
>
> Using the tag value to store stuff is generally not a good solution, and
> never was (well, perhaps
> before classes). The disadvantages of the tag speak for itself, ONE
> location to store how much
> stuff? Packing, unpacking variables that you want to store there,
> overwriting data from the
> previous programmer, and the list goes on.
>
> Look, MS very kindly gave us Classes and WithEvents.
>
> Classes and Withevents is EASY. Classes and Withevents prepares you for
> programming in other
> platforms such as dotnet. Classes and withevents provide you with extremely
> powerful methods of
> handling repetitive programing. Classes provide you with encapsulation of
> code and data. If you
> are a programmer, all of these things should matter to you.
>
> If you can program Code Behind Form, if you can do things like the example
> code that Max so kindly
> provided, then classes are a tiny step that will increase your skill and
> ability an order of
> magnitude. AccessD has many developers using Classes and Withevents.
> Perhaps they can speak up
> with their opinions on the subject.
>
> If you want to learn how to do what Stuart was asking about using a single
> pair of classes (a form
> class and a combo class), speak up and I will start a thread on the
> subject. I will teach you how
> to do this stuff, step by step, and in just a few emails you too can be
> using classes and withevents.
>
> John W. Colby
> www.ColbyConsulting.com
>
>
> Max Wanadoo wrote:
> > Hi Stuart,
> > Here are two routines which you may care to look at. The first is to
> store
> > the value into the .TAG property of the control.
> > The second just parses the controls.
> > Might be of interes, might not, don't know, submitted as is - chuck it if
> no
> > good.
> > Regards
> > Max
> >
> > Public Function pubFunUpdateTagData(frm As Form)
> > On Error Resume Next
> > ' this puts the data into the tag before any changes are made
> >
> > Dim ctl As Control, z As Variant
> > For Each ctl In frm.Controls
> > With ctl
> > Select Case .ControlType
> > Case acTextBox ' this can hold numbers, strings and dates etc
> > Select Case varType(frm(ctl.Name))
> > Case 2, 3, 4, 5, 6 ' int,long,single,double,currency
> > frm(ctl.Name).Tag = Val(frm(ctl.Name))
> > Case 7
> > frm(ctl.Name).Tag = CStr(frm(ctl.Name))
> > Case 8
> > frm(ctl.Name).Tag = frm(ctl.Name)
> > End Select
> > Case acCheckBox
> > frm(ctl.Name).Tag = frm(ctl.Name)
> > Case acComboBox
> > Select Case frm(ctl.Name).RowSourceType
> > Case "Table/Query"
> > frm(ctl.Name).Tag = Nz(frm(ctl.Name).Column(1))
> > 'MsgBox frm(ctl.Name).Tag
> > Case "Value List"
> > frm(ctl.Name).Tag = Nz(frm(ctl.Name).Column(0, 0))
> > Case Else
> > End Select
> > Case acListBox
> > frm(ctl.Name).Tag = Nz(frm(ctl.Name).Column(1), "")
> > Case acOptionGroup
> > frm(ctl.Name).Tag = Nz(frm(ctl.Name), 0)
> > End Select
> > End With
> > Next ctl
> >
> > exithere:
> > Exit Function
> > errhandler:
> > MsgBox "Error in MCM_PeopleChanges.pubFunUpdateTagData: " & Err.Number &
> > vbCrLf & Err.Description
> > Resume exithere
> > End Function
> >
> > Private Function RebuildPersonsFlagsFormsControls(frm As Form, lngPID As
> > Long)
> > On Error Resume Next
> > Dim ctl As Control, strDesc As String
> > Dim varSource As Variant, varvalue As Variant, varType As Variant,
> varName
> > As Variant
> > Dim varVisible As Variant
> > strDesc = frm.Name
> > With frm
> > For Each ctl In frm.Controls
> > varName = ctl.Name
> > varType = ctl.ControlType
> > Select Case varType
> > Case acTextBox
> > varSource = ctl.ControlSource
> > varvalue = ctl.OldValue
> > varVisible = ctl.Visible
> > If Not IsNull(varSource) And Len(varSource) > 0 And _
> > Not IsNull(varvalue) And Len(varvalue) > 0 And varVisible = True
> > Then
> > Call mcmSetFlag(strDesc & ":" & varSource & ":" & varvalue,
> > lngPID, conFlagsForms)
> > End If
> > Case acComboBox
> > varSource = ctl.ControlSource
> > varvalue = ctl.OldValue
> > If Not IsNull(varSource) And Len(varSource) > 0 Then
> > Call mcmSetFlag(strDesc & ":" & varSource & ":" & varvalue,
> > lngPID, conFlagsForms)
> > End If
> > Case acCheckBox
> > varSource = ctl.ControlSource
> > varvalue = ctl.OldValue
> > If varvalue = True Then
> > Call mcmSetFlag(strDesc & ":" & varSource & ":" & varvalue,
> > lngPID, conFlagsForms)
> > End If
> > Case acOptionGroup
> > varSource = ctl.ControlSource
> > varvalue = ctl.OldValue
> > Call mcmSetFlag(strDesc & ":" & varSource & ":" & varvalue, lngPID,
> > conFlagsForms)
> > Case acSubform
> > Case acLabel
> > Case acBoundObjectFrame
> > Case acPage
> > Case acPageBreak
> > Case acCommandButton
> > Case acCustomControl
> > Case acRectangle
> > Case acImage
> > Case acTabCtl
> > Case acLine
> > Case acToggleButton
> > Case acObjectFrame
> > Case acListBox
> > Case acOptionButton
> > Case Else
> > MsgBox "NewType found in RebuildPersonsFalgsSystemControls:",
> > varType, varName
> > End Select
> > Next ctl
> > End With
> > End Function
> --
> 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
>



More information about the AccessD mailing list