Results 1 to 3 of 3
  1. #1
    theosgood is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Denver, CO
    Posts
    30

    How do you populate a field bound text box with an unbound text box value?

    I have a table, MOL, that has a text field Offer_Desc. The powers that be decided that they wanted 5 pieces of information in a specific order and each piece should be editable. The first piece can be a price, a % off or a $ off and the fields already exist in the table. I added the other 4 text fields to the table. The idea is to concatenate these 5 pieces of information into the Offer_Desc field.

    I created a form with the 7 total fields. I then created an OfferDesc text box with the control source:
    =IIf([Item Promo Price]=0,IIf([Category Discount]=0,Format([DollarOff],"Currency"),Format([Category Discount],"0%")),Format([Item Promo Price],"Currency")) & "; " & [Gender] & " " & [VendorName] & " " & [ModelName] & " " & [ItemDesc]. This works great. (thanks again PBaldy for that answer)

    Now I need to use the value in the text box to populate the Offer_Desc field. I tried setting the Offer_Desc default value in the table to the same expression, but it does not recognize either the field [Item Promo Price] or the default value.

    I added the Offer_Desc as a hidden field in the form and set the default value = to OfferDesc using a number of syntaxes, with/without [], using the form name, tried a dlookup, This is a tabbed form with all info in the first tab. Tried moving the Offer_Desc field to a following tab and adding a me.refresh for on click of the tab. Nothing seems to be working.



    How does one populate a field bound text box with an unbound text box value?

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The default value property only affects NEW records. Since you have a hidden control bound to the "Offer_Desc" field, use the FORM Before Update event to push the calculated value into the hidden control.
    Try this:
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
       'Offer_Desc is a     hidden, bound     control
       'OfferDesc is  a calculated, unbound control
       Me.Offer_Desc = Me.OfferDesc
    End Sub

  3. #3
    theosgood is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2012
    Location
    Denver, CO
    Posts
    30
    Thanks Steve. I was thinking in terms of the field alone. Putting it at the form level made sense as soon as I read your reply.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Concatenating (2x unbound into bound text box)
    By justinwright in forum Programming
    Replies: 1
    Last Post: 08-19-2010, 08:11 AM
  2. Use a combo box to populate a text field
    By niesenj in forum Forms
    Replies: 2
    Last Post: 01-29-2010, 01:57 PM
  3. Bound a unbound text box to the table
    By Brian62 in forum Forms
    Replies: 1
    Last Post: 11-06-2009, 11:05 AM
  4. I can't enter text in a bound text box
    By Jerry8989 in forum Forms
    Replies: 3
    Last Post: 10-05-2009, 11:52 AM
  5. Unbound text box truncating text
    By gddrew in forum Forms
    Replies: 0
    Last Post: 03-02-2006, 11:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums