Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2015
    Posts
    2

    Unanswered: Make a column editable for new record only

    I have what I thought would be a fairly simple task for the database I'm working on, but I'm stumped right now. I have only been using access for a week now but have managed to build a database and get a working form together. I made one the columns read only because I don't want anybody changing it after the record has been created. I have a button to add a new record, which works fine in itself but i can't figure out how to make the read only column editable for a new record. Basically, I just need the column to become editable with a new record and go back to read only once the new record is made.

    I tried using a loop to keep it writable while Me.AddNewRecord is true, but that caused the program to crash. I also tried Me.Sleeve.Enabled = Me.AddNewRecord but that completely disabled the new record action.

    I've been messing with this for quite a while and have searched around with no luck. If anybody could give me a push in the right direction that would be great, thanks.

    Using Access 2010

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    change the forms display mode, forget the details but you can set a forms property to be add only...
    there was another post recently about this
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2015
    Posts
    2

    Got it!

    I think I got it figured out.

    In the Form Load section:

    Me.Sleeve.Enabled = False

    When the new record button is clicked:

    Private Sub AddSleeve_Click()

    DoCmd.GoToRecord , , acNewRec
    Me.Sleeve.Enabled = True

    End Sub

    Then I found that you can do a leave cell action:

    Private Sub Sleeve_Exit(Cancel As Integer)

    Me.Sleeve.Enabled = False

    End Sub

    When the new record is added it allows the cell to be edited but goes back to read only when you leave the cell.

Posting Permissions

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