Global Const (MY_VERSION$) 's value will not display in textbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MLH

    Global Const (MY_VERSION$) 's value will not display in textbox

    I have 2 global constants declared in the same global module:
    Global Const MY_VERSION$ = "1.04"
    Global Const ProjectName$ = "MyProj"

    I have 2 global procedures designed to return the
    value of these 2 constants...

    Function GetCurrentRev() As String
    GetCurrentRev = MY_VERSION$
    End Function

    Function GetProjectName( )
    GetProjectName = ProjectName$
    End Function

    I have 2 bound textbox controls on the same form
    (frmAdminDoList EntryForm)
    referencing the above 2 functions in the 2 textbox's DefaultValue
    property. One textbox is named Text106 and the other ProjNameBox. They
    are bound to [Rev] and [ProjName] query fields respectively and the
    form itself is bound to qryAdminDoList.

    When I go to a new rec on that form, the 2 textboxes display #Name?
    and "MyProj" respectively. I'm trying to determine why one textbox
    displays the value of a global string var and the other does now? If I
    run either of the functions in the immediate window - each displays
    the expected value of the related global constant. I see these two
    textboxes and their related functions and values as virtually
    identical and have no earthly idea why one is working and the
    other is not.

    My earlier thread on this subject was perhaps mis-titled and I'm
    picking up from here. After reading this post, if you still think I'm
    asking "What's the meaning of #Name?" then feel free to bow
    out of this thread.
  • rkc

    #2
    Re: Global Const (MY_VERSION$) 's value will not display in textbox

    MLH wrote:[color=blue]
    > I have 2 global constants declared in the same global module:
    > Global Const MY_VERSION$ = "1.04"
    > Global Const ProjectName$ = "MyProj"
    >
    > I have 2 global procedures designed to return the
    > value of these 2 constants...[/color]

    Just for kicks, create a new form with nothing but two
    textboxes on it and see if you can get them to work with
    your functions.

    Comment

    • Randy Harris

      #3
      Re: Global Const (MY_VERSION$) 's value will not display in textbox


      "rkc" <rkc@rochester. yabba.dabba.do. rr.bomb> wrote in message
      news:PWQ9f.1018 86$K91.37488@tw ister.nyroc.rr. com...[color=blue]
      > MLH wrote:[color=green]
      > > I have 2 global constants declared in the same global module:
      > > Global Const MY_VERSION$ = "1.04"
      > > Global Const ProjectName$ = "MyProj"
      > >
      > > I have 2 global procedures designed to return the
      > > value of these 2 constants...[/color]
      >
      > Just for kicks, create a new form with nothing but two
      > textboxes on it and see if you can get them to work with
      > your functions.[/color]

      Or - exchange the default value between the controls. That will tell you if
      the problem is the control or the function. (Note: one of your functions
      returns a string, the other a variant)

      Comment

      • MLH

        #4
        Re: Global Const (MY_VERSION$) 's value will not display in textbox

        Well, you are certainly on to something there, rkc. I did
        what you said and the textboxes worked FINE with the
        same two functions. That sure leaves me in a rut, as I
        have no earthly idea what could be going on in my first
        form to contribute to this behavior. Thx 4 the heads up!
        xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxx
        [color=blue]
        >Just for kicks, create a new form with nothing but two
        >textboxes on it and see if you can get them to work with
        >your functions.[/color]

        Comment

        • MLH

          #5
          Re: Global Const (MY_VERSION$) 's value will not display in textbox

          I was intrigued by the suggestion. I did exchange the default value
          between the two controls. The behavior was the same. Yes, sad,
          but true. Of course, the controls were reversed and each one
          displayed what was previously displayed in the other.
          xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx[color=blue]
          >
          >Or - exchange the default value between the controls. That will tell you if
          >the problem is the control or the function. (Note: one of your functions
          >returns a string, the other a variant)[/color]

          Comment

          • MLH

            #6
            Re: Global Const (MY_VERSION$) 's value will not display in textbox

            I even went so far in the new form as to rename the two
            textbox controls to odd names - one qwertyu and the other
            asdfghjk. Still, the form worked perfectly, with both controls
            displaying EXACTLY what one would expect them to show
            when going to a new record - the default values of the 2
            global constants.

            [color=blue][color=green]
            >>Just for kicks, create a new form with nothing but two
            >>textboxes on it and see if you can get them to work with
            >>your functions.[/color][/color]

            Comment

            • rkc

              #7
              Re: Global Const (MY_VERSION$) 's value will not display in textbox

              MLH wrote:[color=blue]
              > I even went so far in the new form as to rename the two
              > textbox controls to odd names - one qwertyu and the other
              > asdfghjk. Still, the form worked perfectly, with both controls
              > displaying EXACTLY what one would expect them to show
              > when going to a new record - the default values of the 2
              > global constants.[/color]

              Open your new form and your troublesome form.
              Delete the textboxes on the troublesome form.
              Copy and paste the textboxes from your new form to your
              troublesome form.

              Comment

              • Randy Harris

                #8
                Re: Global Const (MY_VERSION$) 's value will not display in textbox

                If the problem switched, you have something wrong with your control. Just
                recreate it. Or, as rkc suggested, copy it from the working form.

                "MLH" <CRCI@NorthStat e.net> wrote in message
                news:r6vfm155th ktc1r4b3d3akho9 l69q3dmfj@4ax.c om...[color=blue]
                > I was intrigued by the suggestion. I did exchange the default value
                > between the two controls. The behavior was the same. Yes, sad,
                > but true. Of course, the controls were reversed and each one
                > displayed what was previously displayed in the other.
                > xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx[color=green]
                > >
                > >Or - exchange the default value between the controls. That will tell you[/color][/color]
                if[color=blue][color=green]
                > >the problem is the control or the function. (Note: one of your functions
                > >returns a string, the other a variant)[/color]
                >[/color]

                Comment

                • MLH

                  #9
                  Re: Global Const (MY_VERSION$) 's value will not display in textbox

                  I did it, crossed my fingers and all that good stuff.
                  Same problem. Believe me, I've deleted and recreated
                  those two controls so many times - its not even funny.
                  I think I may copy the form to a temporary working copy,
                  trash one object at a time from the copy - testing the form
                  after each deletion to see if any object may be singled out
                  as the offending object. Its quite frustrating, actually.

                  I'm confident that its something simple that is being overlooked.
                  In a brand new form, it works. So, the issue is most certainly
                  form-specific.
                  xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx
                  [color=blue]
                  >
                  >Open your new form and your troublesome form.
                  >Delete the textboxes on the troublesome form.
                  >Copy and paste the textboxes from your new form to your
                  >troublesome form.[/color]

                  Comment

                  • MLH

                    #10
                    Re: Global Const (MY_VERSION$) 's value will not display in textbox

                    On Wed, 02 Nov 2005 00:43:25 GMT, "Randy Harris" <randy@SpamFree .com>
                    wrote:
                    [color=blue]
                    >If the problem switched, you have something wrong with your control.[/color]
                    I'm not sure I understand. I had (A) a working control and (B) a non-
                    working control. I switched their default values. I then had (A) a
                    nonworking control and (B) a working control. That seems to suggest
                    to me that, depending on what default value property setting EITHER
                    control has - both can be working or non-working. I think that means
                    the controls both work. Its just that any control with
                    =GetCurrentRev( ) as its default property setting does not work. I tend
                    to think its that setting that is the problem rather than the control.
                    Does that make sense?
                    [color=blue]
                    >Just recreate it. Or, as rkc suggested, copy it from the working form.[/color]

                    Comment

                    • Randy Harris

                      #11
                      Re: Global Const (MY_VERSION$) 's value will not display in textbox


                      "MLH" <CRCI@NorthStat e.net> wrote in message
                      news:395gm117kq jc4nb19ha13pigk l0j41dn58@4ax.c om...[color=blue]
                      > On Wed, 02 Nov 2005 00:43:25 GMT, "Randy Harris" <randy@SpamFree .com>
                      > wrote:
                      >[color=green]
                      > >If the problem switched, you have something wrong with your control.[/color]
                      > I'm not sure I understand. I had (A) a working control and (B) a non-
                      > working control. I switched their default values. I then had (A) a
                      > nonworking control and (B) a working control. That seems to suggest
                      > to me that, depending on what default value property setting EITHER
                      > control has - both can be working or non-working. I think that means
                      > the controls both work. Its just that any control with
                      > =GetCurrentRev( ) as its default property setting does not work. I tend
                      > to think its that setting that is the problem rather than the control.
                      > Does that make sense?
                      >[color=green]
                      > >Just recreate it. Or, as rkc suggested, copy it from the working form.[/color]
                      >[/color]

                      You're right, I didn't think it through. If you get the problem with that
                      function regardless of which control you use, then the problem must be with
                      the function. I don't know why it would matter, but change the data type as
                      I suggested earlier.

                      Comment

                      • Trevor Best

                        #12
                        Re: Global Const (MY_VERSION$) 's value will not display in textbox

                        MLH wrote:[color=blue]
                        > I did it, crossed my fingers and all that good stuff.
                        > Same problem. Believe me, I've deleted and recreated
                        > those two controls so many times - its not even funny.
                        > I think I may copy the form to a temporary working copy,
                        > trash one object at a time from the copy - testing the form
                        > after each deletion to see if any object may be singled out
                        > as the offending object. Its quite frustrating, actually.
                        >
                        > I'm confident that its something simple that is being overlooked.
                        > In a brand new form, it works. So, the issue is most certainly
                        > form-specific.
                        > xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxx[/color]

                        Long Shot: Check the code behind that form and make sure it doesn't
                        contain anything like:
                        Function GetProjectName( )
                        GetProjectName = "#Name?"
                        End Function
                        ;-)

                        Actually, while it's displaying #Name? Can you edit the field?

                        Create new form, copy all the good bits from old form.

                        Comment

                        • lylefair

                          #13
                          Re: Global Const (MY_VERSION$) 's value will not display in textbox

                          Did you actually look at the bound "property" of the control which
                          shows #Name, ie the property that connects it with a field in the
                          form's recordset. Are you sure the field to which you have bound the
                          control actually exists; are you sure there is no syntax error in your
                          defining this?

                          Comment

                          • rkc

                            #14
                            Re: Global Const (MY_VERSION$) 's value will not display in textbox

                            MLH wrote:[color=blue]
                            > I did it, crossed my fingers and all that good stuff.
                            > Same problem. Believe me, I've deleted and recreated
                            > those two controls so many times - its not even funny.
                            > I think I may copy the form to a temporary working copy,
                            > trash one object at a time from the copy - testing the form
                            > after each deletion to see if any object may be singled out
                            > as the offending object. Its quite frustrating, actually.
                            >[/color]

                            You're using the functions as the Default Value property
                            of the controls, correct?

                            Did the #Name error occur before or after you set the
                            Control Source property of the controls you cut & paste?
                            Did you even try the form before you did?

                            Comment

                            • David W. Fenton

                              #15
                              Re: Global Const (MY_VERSION$) 's value will not display in textbox

                              MLH <CRCI@NorthStat e.net> wrote in
                              news:ut4gm1d6iq 112ioqrjbcp9sv7 htoppjrm3@4ax.c om:
                              [color=blue]
                              > I'm confident that its something simple that is being overlooked.
                              > In a brand new form, it works. So, the issue is most certainly
                              > form-specific.[/color]

                              Do you have anything in the problematic with the same name as the
                              function you're calling?

                              --
                              David W. Fenton http://www.bway.net/~dfenton
                              dfenton at bway dot net http://www.bway.net/~dfassoc

                              Comment

                              Working...