Results 1 to 4 of 4
  1. #1
    shylock is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Sep 2018
    Location
    Dayton, Ohio
    Posts
    100

    Can't Edit When Data Based On Expression

    I have record set that populates a continuous form. I want to be able to edit the contents of any row on the form. Especially the dates and times. However, I get an error stating that since the date and/or time data is based on an expression, it can't be edited. I have tried DateValue, TimeValue and formatted the Date and Time text boxes as Short Date and Short Time, respectively, without altering the BeginDate and EndDate field in the query. CDate Will not work as it delivers the date with the time. Does anyone have any suggestions on how I can enable editing? The populated form and query are shown below:

    SELECT TOP 50 DowntimeEvent.DowntimeEventID, Format(DowntimeEvent.BeginDate,"MM/DD/YYYY") AS ["Begin Date"], DowntimeEvent.BeginDate-Int(DowntimeEvent.BeginDate) as ["Begin Time"], Format(DowntimeEvent.EndDate, "MM/DD/YYYY") AS ["End Date"], DowntimeEvent.EndDate-Int(DowntimeEvent.EndDate) AS ["End Time"], DowntimeEvent.Description, DowntimeEvent.Planned, DowntimeEvent.ReportedBy, DowntimeEvent.ServerName
    FROM DowntimeEvent
    ORDER BY DowntimeEvent.BeginDate DESC;



    Click image for larger version. 

Name:	Results of Q-3.PNG 
Views:	20 
Size:	18.2 KB 
ID:	35769

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    Can you post a copy of the db with just a few dummy records to illustrate the problem
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    A calculated field is never editable.

    Use Format property or InputMask property. I use InputMask: 99/99/"20"00;0; For time try InputMask: 99:99\ L"M";0;

    Users have to type the / or : if they don't enter 2 digits for each part.

    The Date Picker will not be available.


    Don't include quote marks in alias name construct, should be just: AS [Begin Date]. Advise no spaces nor punctuation/special characters (underscore only exception) in names. However, since you should not be constructing these calculated fields to begin with, moot point.
    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.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    in order to be able to edit the control (and save the changes) the control needs to be bound to a field in a table. In your case date and time (one field) are separated into two controls - if you edit the field as a date, you lose the time element and edit the time, you lose the date element. If this was a single form, It would not be an issue, you would have two unbound controls one for date and one for time and then combine the two before the record is updated. But that won't work with continuous forms.

    So I think you have two options:

    1. Split the time element out and store in a separate field, adding them together as and when required
    2. have a separate single form (which could be a subform to the continuous form header or footer) for editing the data - you can set the link child/master properties so it displays the current record selected in the continuous part.

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

Similar Threads

  1. Role Based Access to Edit
    By rch918 in forum Access
    Replies: 1
    Last Post: 12-28-2016, 03:50 PM
  2. Replies: 3
    Last Post: 03-27-2014, 05:05 PM
  3. Replies: 1
    Last Post: 03-13-2014, 03:02 PM
  4. form based on query - cant edit records
    By tweety in forum Forms
    Replies: 7
    Last Post: 04-10-2013, 03:42 PM
  5. An expression to edit a single row
    By senghlim in forum Access
    Replies: 4
    Last Post: 10-29-2010, 01:20 PM

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