Re: Problem with .properties("...")

Tech-Archive recommends: Fix windows errors by optimizing your registry



Bob,

Thanks for the extensive explanation.

sounds like whatever you are doing is guessing and finding the first
"Properties" reference it can find.  The DAO object may have that but the VB
Form object does not.

This is probably what F1 is doing "all by electric".

... If you are declaring variables "as object" or "as
variant" then VB can't catch problems at compile time and will raise errors
at runtime.

Is there any way to declare something like "As DAO Object"?

Maybe...  in VB you probably want to look at something like

dim c as control
for each c in Me.Controls
  If TypeOf C Is Label Then
    c.caption="new value"
  elseif typeof c is TextBox then
    ...
  end if
next

Yea, there are a number of such possibilities, e.g. I could just pass the control and the name of the property I want to translate as two separate arguments. Unfortunately, whatever I do, I'll now have to have TWO routines, one for translating DAO properties and one for translating VB properties - no disaster, but definitely a lot less elegant.


or maybe a Select case using the TypeName(c) function...

Unfortunately, TypeName doesn't separate VB from DAO objects. I wonder if there is SOME way to do this short of taking an error on VB objects?


You can pass the controls around "As Obejct" or "As Control" and then work
with the properties and it may be that it's a bit more code than in VBA but
ya gotta do what ya gotta do! <g>

Yea - just makes more code because each language-localized property of the control, e.g. tool tips, must be handled separately in code, and this code must be separate from the code that translates the DAO properties like column headings and descriptions.


Perhaps you can write a class that accepts a control and exposes a
"Properties" collection that translates things for you to keep much of your
existing VBA code.  OTOH, twisting a VBA-style solution into a VB container
may be harder to work with in the long run than simply rewriting the code in
a more VB-like style now.

Yea, you are probably right here. I have already written a ControlType routine to carry this capability over to VB, as without THAT the code would be a TOTAL mess of coding every possibility rather than just spinning through the controls. I suspect that there is some intelligent middle ground here.


Verification of basic assumption: The original code absolutely presumed that one of the following two situations is true for EVERY form, control, DAO object, etc., that a user would ever see:
1. It already has a "Tag" property, or
2. It would accept a new user-made "Tag" property.
So long as one of the above is true, the additional properties needed to make multi-lingual operation work could all be stuffed into the Tag property, which would be manufactured as needed. These additional properties include the present language of the control and the original English texts for each of its user-visible properties. If this STILL holds, which it looks like it may, then the recoding shouldn't be TOO bad.


Mostly for documentation, I am now converting this using #If statements as though I may ever want to go back to Access. I may want to reconsider this decision if things get TOO twisted up around the differences between VB and VBA.

It sounds like I now understand my purgatory. I won't love the result, but at least I can now code it. I'll quit my complaining and get back to programming. Thanks again for your help.

Steve Richfie1d
.



Relevant Pages

  • Re: Elementary Qs on objects
    ... You should take a look at Mike Lischke's TThemeManager component. ... of its owner's routines -- so that it can get notification whenever its ... would use the same technique to know when new components need translating. ... before TThemeManager had a chance to insert its hook, or when a control ...
    (alt.comp.lang.borland-delphi)
  • =?ISO-8859-1?Q?Re=3A_Cubic_B=2DSpline_to_B=E9zier?=
    ... Translating from b-spline control points for use in a Cubic Bezier ...
    (comp.graphics.algorithms)
  • Re: how to convert this (right version)?
    ... any particular reason you're translating this to JScript? ... control itself is IE/Windows only, ...
    (microsoft.public.scripting.jscript)
  • =?iso-8859-1?q?Re:_wikipedia_question=CA=F2?=
    ... someone else will try to control it to say what they want it to. ... Hmm. ... I'm translating a "starred" and clearly better article. ... that whoever wrote the current article will prick up their ears and ...
    (sci.lang.japan)