> One other thing - I cannot change the 3 type statements as they are
> currently used to pass records between machines over the internet to a
> programs expecting the data in a certain format. Otherwise my problem
would
> be easily sorted my combining all the elements into one type statement.
> I just want to use some code written for something else without the need
for
> a massive editing excersise.
> > Its difficult to explain
> > Project A has 3 distinct UDTs that differ but have certain things in
> common,
> > eg
> > TYPEA
> > fred as string
> > bill as integer
> > END TYPE
> > TYPEB
> > fred as string
> > bill as integer
> > ginger as string
> > END TYPE
> > TYPEC
> > fred as string
> > bill as integer
> > tom as boolean
> > END TYPE
> > --------------------------------------------------------------
> > I want to use code from Project B which goes something like
> > if X.fred = "YM" then
> > if X.bill=1 then
> > ..................................
> > end if
> > end if .........................hundreds of lines of code that uses the
> type
> > My problem is, I don't want to spend days having to modify code for all
> > three types if I can get away with
> > If a=1 then
> > Dim X as TYPEA
> > end if
> > If a=2 then
> > Dim X as TYPEB
> > end if
> > If a=3 then
> > Dim X as TYPEC
> > end if
> > Then
> > if X.fred = "YM" then
> > if X.bill=1 then
> > ..................................
> > end if
> > end if
> > would work. But of course I cannot do that.
> > > > > > > Hi
> > > > > > > I wonder if anyone can help will a coding problem I have.
> > > > > > > In my Module I have 3 TYPE(s) declared.
> > > > > > > In the form I can refer to these as:
> > > > > > > Dim Fred1 as TYPE1
> > > > > > > Dim Fred2 as TYPE2
> > > > > > > Dim Fred3 as TYPE3
> > > > > > > What I would like to do (and VB6 doesn't seem to want to let
me)
> > is to
> > > > use
> > > > > > > some code to address each of the 3 different types without
> having
> > to
> > > > code
> > > > > > > for each type, for example:
> > > > > > > if fred1.s1 = 2 then
> > > > > > > ............
> > > > > > > end if
> > > > > > > where s1 is common to all 3 types.
> > > > > > > What I don't want to do is code for each of the differing
types
> > and
> > > > then
> > > > > > do
> > > > > > > something like:
> > > > > > > if fred1.s1 = 2 then
> > > > > > > end if
> > > > > > > if fred2.s1 = 2 then
> > > > > > > end if
> > > > > > > if fred3.s1 = 2 then
> > > > > > > end if
> > > > > > > What I would really like to is something like
> > > > > > > if a=1 then
> > > > > > > dim fred as type1
> > > > > > > end if
> > > > > > > if a=2 then
> > > > > > > dim fred as type2
> > > > > > > end if
> > > > > > > etc but of course it won't let me do this as it says there are
> > > > duplicate
> > > > > > > declarions.
> > > > > > > The Redim also doesn't work (at least the way I've tried it)
as
> it
> > > > just
> > > > > > > gives a syntax error.
> > > > > > Will it work with
> > > > > > If a = 1 Then
> > > > > > Dim fred As Type1
> > > > > > ElseIf a = 2 Then
> > > > > > Dim fred As Type2
> > > > > > ElseIf a = 3 Then
> > > > > > Dim fred As Type3
> > > > > > End If
> > > > > No, because allocation statements are <all> compiled before
> execution,
> > > > > so this construction (as well as John's attempt) is that same as
if
> > > > > you'd written--
> > > > > Dim fred As Type1
> > > > > Dim fred As Type2
> > > > > Dim fred As Type3
> > > > > .
> > > > > .
> > > > > .
> > > > > If a = 1 Then
> > > > > ElseIf a = 2 Then
> > > > > ElseIf a = 3 Then
> > > > > End If
> > > > > And this is obviously not allowed--
> > > > > I think best is JFrench's suggestion to consolidate the Types into
> one
> > > > > Mega-Type or to provide more incentive for what is <really> trying
> to
> > > > > accomplish per Mike's suggestion...
> > > > As expected;(
> > > > He can also depending on a's value call three different subs/funcs.
> But
> > as U
> > > > say it depends on...
> > > Henning,
> > > Yeah, I started to put that in as an option too, but decided it wasn't
> > > worth it unless knew more...
> > > Subject Switch/
> > > You get anywhere on the time synch problem/issue? I'm going to do
some
> > > looking for a good time server/client for WinXX today to solve my
> > > problem wrt migration to NT from OS/2...I'm assuming they're out
there,
> > > you interested for your case if I come across something interesting?