Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2013
    Posts
    82

    Unanswered: Can't Add New Record

    I have a form that won't allow new records when the last record is set to read only (not allowing edits).

    It works fine until I close the last work order. If I leave the last work order open then new records can be added.

    Does anyone know why this is happening?

    Thanks.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    sounds liek a default behaviour for Access, if yoiu set the form to read only, then when you get to the end of the recordset it locks the add buytton

    what you coudl do is have a button that is disabled when the form is read/write and enabled when read only. prtessign that buttons will then set the property to read/write
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Aug 2013
    Posts
    82
    I did notice that going into the table directly allows for new records but not in the form.

  4. #4
    Join Date
    Aug 2013
    Posts
    82
    I have a check box on the table for Close Form yes/no. I have a popup form to close the work order by selecting yes for closing that particular work order.

  5. #5
    Join Date
    Aug 2013
    Posts
    82
    I was wondering if leaving one open work order at the beginning of the recordset and reordering the table in some way to allow for additions of new records from the form.

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    bear n mind a table is differrent to a form, its one of the problems with most access applications is that you can put all the security/logic you like in the form but you cannot enforce that security/'business logic if users have access to a table or datasheet displaying table data

    if you now what you did to lock the form, then place the code behind a button to do the opposite
    I'd rather be riding on the Tiger 800 or the Norton

  7. #7
    Join Date
    Aug 2013
    Posts
    82
    The database is split so users can't get to the tables. I was just trying to see if I can add a new record when the previous one is closed.

  8. #8
    Join Date
    Aug 2013
    Posts
    82
    I have this code for closing the work order:


    Private Sub Form_Current()
    If Me.CloseWorkOrder = True Then

    Me.AllowAdditions = False
    Me.WorkorderParts.Form.AllowAdditions = False
    Me.AllowDeletions = False
    Me.WorkorderParts.Form.AllowDeletions = False
    Me.AllowEdits = False
    Me.WorkorderParts.Form.AllowEdits = False

    Else

    Me.AllowAdditions = True
    Me.WorkorderParts.Form.AllowAdditions = True
    Me.AllowDeletions = True
    Me.WorkorderParts.Form.AllowDeletions = True
    Me.AllowEdits = True
    Me.WorkorderParts.Form.AllowEdits = True

    End If
    End Sub

    ****************************

    Is there a way to alter this so it allows for new records no matter the condition of previous records?

  9. #9
    Join Date
    Aug 2013
    Posts
    82
    I forgot to mention this is in the On Current event procedure of the form.

  10. #10
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Is there a way to alter this so it allows for new records no matter the condition of previous records?
    look at your code see anything relevant to your current problem?

    you are doing more than just locking a row from being edited
    I'd rather be riding on the Tiger 800 or the Norton

  11. #11
    Join Date
    Aug 2013
    Posts
    82
    Not sure what you mean? The work orders need to be in a closed state when finished so they cannot be altered. Am I not doing this correctly?

  12. #12
    Join Date
    Aug 2013
    Posts
    82
    Should I remove the allow additions parts?

    Private Sub Form_Current()
    If Me.CloseWorkOrder = True Then


    Me.AllowDeletions = False
    Me.WorkorderParts.Form.AllowDeletions = False
    Me.AllowEdits = False
    Me.WorkorderParts.Form.AllowEdits = False

    Else

    Me.AllowDeletions = True
    Me.WorkorderParts.Form.AllowDeletions = True
    Me.AllowEdits = True
    Me.WorkorderParts.Form.AllowEdits = True

    End If
    End Sub

  13. #13
    Join Date
    Aug 2013
    Posts
    82
    I removed the allow additions parts and did a test. It seems to be working correctly now.

    Thank you very much for pointing out what should have been obvious to me.

Posting Permissions

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