Event procedure on 'unbound' textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crazyhouse
    New Member
    • Aug 2008
    • 31

    #1

    Event procedure on 'unbound' textbox

    I want to use temporary information from an unbound textbox, but i cant seem to run any code on an unbound textbox. Is this possible. I have it working with a bound "control" but cant seem to make it work with an unbound control.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    You can easily retrieve information from an 'Unbound' Text Box in the same fashion as a 'Bound' Text Box. The only difference is that, not to be redundant, it is not Bound to a Field.

    Comment

    • Stewart Ross
      Recognized Expert Moderator Specialist
      • Feb 2008
      • 2545

      #3
      Hi, and Welcome to Bytes.

      You don't really provide us with much information here. Unbound controls can be accessed like any other and their contents can indeed be processed in code. But the values of unbound controls cannot be stored (as they are not bound to any underlying fields) so they are inherently volatile.

      Unbound controls on a continuous form (or a datasheet view) also behave differently to bound controls, as the value of the control is not tied to each record. The set of controls displayed in a continuous form or datasheet view is really just one set, repeated on-screen for as many record rows as the screen can display. Unbound controls shown in such lists remain at whatever value they were last set to, showing on-screen as repeating the same contents for the whole list. Accessing the value of the unbound control in such circumstances is likely to yield disappointing results.

      -Stewart

      Comment

      • crazyhouse
        New Member
        • Aug 2008
        • 31

        #4
        Thanks for such fast responses. Here is what i have.

        When i try to build an event for the unbound box, it doesnt automatically start the sub for me. So what i did was used the name of the unbound field (text35) in the line for the code so the code starts like this

        Private Sub text35_afterUpd ate()

        when i open the form i get this error

        the LinkMasterField s property setting has produced this error:"Ambiguou s name detected: text35_afterupd ate'

        I dont want the information to be bound to a field because i dont want the data stored, I appreciate any help that you can provide.

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          "Ambiguous name detected: text35_afterupd ate" usually means that you have two subs with this same name, which isn't allowed! Check your code to see if this is true.

          Linq ;0)>

          Comment

          • crazyhouse
            New Member
            • Aug 2008
            • 31

            #6
            thanks, sorry for the problems

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by crazyhouse
              thanks, sorry for the problems
              It's not a problem, just try to be a little more clearer on what you are requesting. For starters:
              When i try to build an event for the unbound box, it doesnt automatically start the sub for me.
              What exactly do you mean by this statement?

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                Code:
                Private Sub text35_afterUpdate()
                The fact that the A in AfterUpdate isn't capitalized, your statement

                When i try to build an event for the unbound box, it doesn't automatically start the sub for me.
                and the fact that you apparently had more than one copy of this sub (hence the "ambiguous" error) makes me think that you are entering your code "freehand" which is to say typing all of the code, rather than selecting the control, going to Properties - Events, clicking on the desired event and going into the code window thru this route. If you're entering code without going thru this routine, it would explain a lot of your problems.

                Linq ;0)>

                Comment

                • crazyhouse
                  New Member
                  • Aug 2008
                  • 31

                  #9
                  When i stated 'sorry for the problems' it was because i did have more than 1 event for the name. Once i got rid of the extra entries the code ran fine.

                  Comment

                  Working...