Dlookup result into Table field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RayTrussell
    New Member
    • Sep 2014
    • 6

    Dlookup result into Table field

    I get the results to go the textbox on the screen but not to the field to textbox represents (table field).

    thanks
    This is in ms access
    Last edited by RayTrussell; Sep 19 '14, 03:50 PM. Reason: forgot info
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    Ray,

    Have you tried to refersh the Form after the Text Box is updated?

    Comment

    • RayTrussell
      New Member
      • Sep 2014
      • 6

      #3
      Yes, the screen is doing fine it is just display not filling the field

      Comment

      • twinnyfo
        Recognized Expert Moderator Specialist
        • Nov 2011
        • 3662

        #4
        Does the control have as its record source the underlying field in the table? If it is, a refresh should update the field.

        Comment

        • RayTrussell
          New Member
          • Sep 2014
          • 6

          #5
          BoxInfo = Table
          BoxStreet = field name
          StreetDelvInfo = ComboBox selected

          Text box with BoxStreet from BoxInfo

          BoxStreet - Control Source -
          Code:
          =DLookUp("Street","Address","Id=" & [StreetDelvInfo])
          display in the form but is not in the field - BoxStreet even after leaving the form.
          Last edited by zmbd; Sep 20 '14, 04:25 AM. Reason: [z{placed required code tags}]

          Comment

          • twinnyfo
            Recognized Expert Moderator Specialist
            • Nov 2011
            • 3662

            #6
            Ray,

            Your combo box does not have as its control source the Table. You are just telling the Combo Box to look up values from the table.

            The Combo box must have as its control source the Field BoxStreet. Its row source should be a Select Query and Not a DLookUp value. You will always only return one value in your Combo Box, otherwise.

            Comment

            • RayTrussell
              New Member
              • Sep 2014
              • 6

              #7
              The combobox has 4 item id, address, street, zip
              Id is place into BoxInfo BoxHoldId correctly as you said above
              What I'm trying to do is pick one time from the Address table
              - address, street, zip - and place those values into the table BoxInfo as BoxInfo will after 30 day be archived - all id's for BoxInfo may be changed.

              Comment

              • twinnyfo
                Recognized Expert Moderator Specialist
                • Nov 2011
                • 3662

                #8
                Ray,

                I am having trouble understanding what you are saying--please forgive me. However, one key issue is that in Post #5 above, you say BoxStreet has a control source of =DLookUp("Stree t","Address","I d=" & [StreetDelvInfo]), which will not allow you to choose from values. A combo box must have a query (or Select Statement) for a list of values.

                Also, based on the discussion, it is impossible for a Combo Box to have a DLookup Statement as its Control Source AND also be associated with a field in an underlying table.

                Something is amiss with your Form/Table/Combo Box set up.
                Last edited by zmbd; Sep 20 '14, 04:26 AM. Reason: [z{placed required code tags}]

                Comment

                • RayTrussell
                  New Member
                  • Sep 2014
                  • 6

                  #9
                  Sorry wasn't detailed enough.
                  I have header/footer on
                  in the header section I have a combobox from table address:
                  Id, Address, Street, Zip
                  control source is BoxHoldId in the Detail section of the form.

                  detail part of the form I a table BoxInfo:
                  all of the BoxInfo tables are TextBoxes. among those boxes are
                  BoxHoldId control source BoxHoldId
                  BoxAddress control source:
                  Code:
                       =DLookUp("Address","Address","Id=" & [StreetDelvInfo])
                  BoxStreet control source:
                  Code:
                   =DLookUp("Street","Address","Id=" & [StreetDelvInfo])
                  BoxZip control source:
                  Code:
                  =DLookUp("Address","Address","Id=" & [StreetDelvInfo])
                  and more

                  I also have the three field in private variable in event Click
                  from the combobox.
                  any help on getting these from either side would be great.
                  thanks
                  Last edited by zmbd; Sep 20 '14, 04:27 AM. Reason: [z{placed required code tags}]

                  Comment

                  • zmbd
                    Recognized Expert Moderator Expert
                    • Mar 2012
                    • 5501

                    #10
                    RayTrussell
                    This is becoming a lost thread.

                    Rowsource = This is the information that a combobox or list box will display to a user to choose from

                    Control Source = This is what makes a control either "Bound", "Unbound, or "Calculated ." That is to say, this property points to the field of the table or query where the data is to be stored or is used to display the result of a form/report calculated result.

                    The two properties ARE NOT EQUAL nor interchangeable .

                    What information you have provide so far indicates that all of the controls thus-far presented are calculated controls and as such are not automatically stored in the tables. Nor should any calculation be normally stored to any table unless needed for auditing or historical reasons such as a variable discount/tax rate/etc...

                    So, RT, please take a deep breath, review the FAQ - How To Ask A Question , rethink your question clearly, and make that your next post.

                    I will happily take that post and push it into your original post and we can start over (^_^) otherwise I'm afraid that this thread is drowning.
                    Last edited by zmbd; Sep 20 '14, 04:41 AM.

                    Comment

                    • RayTrussell
                      New Member
                      • Sep 2014
                      • 6

                      #11
                      Thanks for the help!!!

                      This was to easy Here is the solution I finally came up with.
                      Code:
                      Sub StreetDelvInfo_Click()
                      
                      Forms!BoxInfoF!BoxAddress = DLookup("Address", "Address", "Id=" & [StreetDelvInfo])
                      Forms!BoxInfoF!BoxStreet = DLookup("Street", "Address", "Id=" & [StreetDelvInfo])
                      Forms!BoxInfoF!BoxZip = DLookup("Zip", "Address", "Id=" & [StreetDelvInfo])
                      
                      End Sub
                      Thanks again it made me dig harder!!!
                      Last edited by zmbd; Sep 21 '14, 05:49 PM. Reason: [Z{Please use the [CODE/] button to format posted script and formated text - Please read the FAQ}]

                      Comment

                      • zmbd
                        Recognized Expert Moderator Expert
                        • Mar 2012
                        • 5501

                        #12
                        I'm glad you found a solution.

                        However, from the solution given, it indicates that your database may suffer from a lack of > Database Normalization and proper Table Structures.

                        In a NEW thread if you list you tables, table relationships, and the goal of your project someone here might be able to help clean up the schema.

                        Comment

                        Working...