Results 1 to 5 of 5
  1. #1
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77

    text box bound and want to overrdie


    have a text box 1stDepositPercentage on form frm_Contract which is bound to a field 1stDepositPercentage in table tbl_Contracts . I have the Control Source set to =IIf(DateDiff("m",[DateofContract],[DateofFunction])<5,0.5,0.2), works great. problem is if the user wants to override that box with their own value. suggestions?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    A textbox with calculation in ControlSource is not bound. A bound control references a field as ControlSource.

    Cannot edit calculated value.

    A calculated value does not automatically save into field so how are you accomplishing that?

    Bind textbox to field and use VBA to set with the calculated result then user can edit at will

    If IsNull(Me.lstDepositPercentage) Then Me.lstDepositPercentage = IIf(DateDiff("m",[DateofContract],[DateofFunction])<5,0.5,0.2)

    Real trick is figuring out what event to put that code into. Perhaps form Current.


    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Or bind the textbox to the field as suggested by June and add your expression to the default value property.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Likely DefaultValue property will not work because expression is dependent on another field that probably needs input. DefaultValue must be able to have a value before any input to record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    jazzy is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    77
    i used VBA to set the values and left it bound to the field, worked well

    Thanks everyone

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

Similar Threads

  1. Help with a bound text box
    By nightangel73 in forum Forms
    Replies: 3
    Last Post: 03-03-2015, 11:06 AM
  2. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  3. Replies: 2
    Last Post: 06-11-2012, 09:37 AM
  4. How to bound a text box
    By bundy75 in forum Forms
    Replies: 10
    Last Post: 07-30-2010, 02:50 PM
  5. 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

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