Results 1 to 9 of 9
  1. #1
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149

    expression field cannot be edited

    I want to create a Continuous Form which shows outstanding invoices with fields: InvoiceNo, InvoiceAmt & SettleAmt.
    The InvoiceNo & InvoiceAmt is locked, user only enter the SettleAmt.
    I set the Record Source = SELECT InvoiceNo, InvoiceAmt, 0 AS SettleAmt FROM Invoice.
    When I view the form, I cannot enter values in SettleAmt.
    It shows that SettleAmt is based on expression and cannot edit.


    What is the proper setting or procedure to implement it?
    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    That's because it is a calculated field. There is no actual table field. If you want textbox to show 0 by default then include actual SettleAmt field in RecordSource and bind textbox to SettleAmt field. Set textbox DefaultValue property to 0.
    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
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    I add the SettleAmt in actual table and include in the RecordSource.
    Now it can edit in the form, and it saves what i entered.
    how to set SettleAmt to 0 whenever the form is open?
    I cannot find the DefaultValue property of the textbox.
    thanks June7.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    DefaultValue property is on Data tab of Property Sheet.
    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
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Thanks June7.
    I overlook it.
    After set the DefaultValue=0, I view the form, it still shows the current SettleAmt values in the table, not shows 0.
    is there any thing else?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    That's how it's supposed to work. Default Value is only applied when new record is initiated.

    Why would you not want to show saved data?
    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.

  7. #7
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Since it allows partial settlement of invoice, so i keep the SettleAmt to 0 everytime, then run some codes to calculate.
    Actually, i want to show in the form is InvoiceNo, OutstandingAmt, SettleAmt.
    The problem is when user want to edit a settle record, how to find the actual OutstandingAmt?
    For example, an invoice $100, first settle $20, second settle $25.
    When user want to edit the first settle record, the OutstandingAmt should be 100-25=75, the entered SettleAmt cannot greater than OutstandingAmt.
    The formula for OutstandingAmt should be InvoiceAmt - sum of SettleAmt of other settlement records.
    How can i implement this?
    Thanks.

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    You need to go back to the drawing board. To implement what you describe you will need a new table to store each SettleAmount (InvoiceNo_FK,SettleAmount, SettleDate) then use a subform to enter those details.
    Now on the Main form you can add an OutstandingAmt = InvoiceAmount-dSum("SettleAmount","tblInvSettle","[InvoiceNo_FK=" & [InvoiceNo]). Or instead of using dSum you could sum it up in the footer of the subform then make a reference to it:OutstandingAmt = InvoiceAmount-Forms!frmMain!sFrmSettleInv.Form.txtTotalSettle


    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #9
    uoghk is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jan 2022
    Posts
    149
    Thanks Gicu.
    Understand.

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

Similar Threads

  1. Replies: 3
    Last Post: 09-21-2018, 03:03 PM
  2. Replies: 10
    Last Post: 07-12-2017, 09:58 AM
  3. Replies: 24
    Last Post: 07-23-2014, 11:36 AM
  4. Can Calculated Field (Text) Be Edited?
    By melhzy in forum Access
    Replies: 1
    Last Post: 11-26-2012, 12:12 PM
  5. Replies: 1
    Last Post: 06-23-2010, 09:05 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