Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prevent form edits (A2k SR1)

    I have a form, frmCheckInLast that uses a select qryCheckInLast as its data source. The input
    criteria is [Enter Room Number]. The query selects the last rental record for that room and
    displays the information in frmCheckInLast. I do not want the operator to be able to edit any of
    the data in this record. I tried setting the form properties, Allow Edits, Allow deletions, Allow
    Additions and Data Entry all to No. This appears to prevent the operator from changing data
    except in those field that have Event Procedures. Once one of those fields is accessed, then any
    field on the forms can be edited.

    The [Event Procedures] fill in certain fields based on the input in other fields.

    FrmCheckInLast also has a New Record button that creates a new record and populates some of
    the fields on the new form with data from the last record. The operator then completes the form
    and saves the record.

    I want the operator to be able to review the information in the last record but to be prevented
    from changing it when thinking they are entering data in the new record.

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Prevent form edits (A2k SR1)

    Tom,

    I do something similar to this in a Material Tracking Database where the user has to transfer property from one Custodian to another. (Similar to your last rental record.)

    What I did is I have a main form that shows the master property data (This could be the hotel and rooms.). A subform details all of the previous tracking data similar to the latest rental information. (None of the data in the master property data or previous tracking data can be edited.) If the user selects new record, i.e., add a new transfer or in your case, add a new rental record, a third form opens that is similar to the previous tracking data. The third form is editable and tied to the same fields as the previous tracking data, however, it writes its data to a temporary table. When the user selects save, the data is moved from the temporary table to the table tied to the previous tracking data (moves the new rental record to the table storing the rental records) and then becomes visible as the latest entry on the form. Once written, the data is locked and uneditable through the form.

    What is neat here is that the user can see the master data (i.e., Hotel and Room Number), and all prior rental records but can't modify them. They can only enter new data that becomes visible after the data is entered.

    I hope this makes sense and gives you some ideas.

    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Prevent form edits (A2k SR1)

    I suppose you have event procedures for the OnExit or OnLostFocus event of some controls. These will fire regardless of whether the user has changed anything in the control. If they change the value of another control, this puts the form in edit mode - apparently this overrides the AllowEdits setting temporarily.

    I avoid using the OnExit and OnLostFocus events to change the value of controls, because they will fire even if the user hasn't changed anything. I use the AfterUpdate event for this - it will only fire if the user has actually changed the value. If you have set AllowEdits to False, the user can't change the value of a control, so the AfterUpdate event won't occur.

  4. #4
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prevent form edits (A2k SR1)

    Your suggestion sounds like a very nice enhancement. I solved the immediate problem with Hans' suggestion and will look into creating a subform in the near future. It appears that this would enable the us to display a room history which would be a nice feature.

    Thanks.

    Tom

  5. #5
    4 Star Lounger
    Join Date
    May 2002
    Location
    Roanoke, Virginia, USA
    Posts
    493
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Prevent form edits (A2k SR1)

    Many thanks for pointing me in the right direction. I was able to combine 2 events into 1 After update event.


    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •