Re: Problem with .properties("...")
- From: Steve Richfie1d <Steve@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 10 Aug 2005 09:29:50 -0600
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 .
- Follow-Ups:
- Re: Problem with .properties("...")
- From: Ken Halter
- Re: Problem with .properties("...")
- References:
- Problem with .properties("...")
- From: Steve Richfie1d
- Re: Problem with .properties("...")
- From: Bob Butler
- Re: Problem with .properties("...")
- From: Steve Richfie1d
- Re: Problem with .properties("...")
- From: Bob Butler
- Problem with .properties("...")
- Prev by Date: Re: Ok in IDE but fails when run as an EXE
- Next by Date: Re: Problem with .properties("...")
- Previous by thread: Re: Problem with .properties("...")
- Next by thread: Re: Problem with .properties("...")
- Index(es):
Relevant Pages
|