Results 1 to 8 of 8
  1. #1
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70

    Problem with adding new record using a Split Form

    I have the following problem - Setting Allow Additions, Allow Edits, Allow Deletions to 'No' in Form Properties then, from a Add Record button, writing Me.AllowAdditions = True, Me.AllowEdits = True, has no effect the screen just locks. The Property SplitFormDatasheet = Allow Edits is set. The same appears to be true for an 'Edit' button (AllowEdits = True) or a Delete button (AllowDeletions = True)

    The only way to make this work seems to be if Allow Additions, Allow Edits, Allow Deletions are all set to 'Yes' in Form Properties.



    This is not very good for controlling what a user does, i.e. A new record should only be added by clicking the Add Record button to which user access is controlled elsewhere.

    Any one have any ideas please?

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Cannot reproduce the problem in v2007. You're sure that you can add a new record if the Form's AllowAdditions Property, in the Property Pane, is set to Yes?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70
    Thank you for your response. I have set out below the behavior I am seeing

    Form Properties
    Split Form Datasheet - Allow Edits

    AllowAdditions - Yes
    Allow Edits –Yes
    AllowDeletions – Yes

    Add Recordbutton code
    Private SubcmdAdd_Click()
    On ErrorGoTo ErrorHandler
    DoCmd.GoToRecord , "", acNewRec
    Me.Entry_Title.SetFocus
    Call Button_Control(False, False, True, False,False, True, True, False, True)
    'Errorhandling
    ErrorHandlerExit:
    Exit Sub
    ErrorHandler:
    strFormProc= strModule & "/cmd_Add_Click"
    CallLogError(strFormProc)
    Resume ErrorHandlerExit
    End Sub

    All works fine– record is added
    Click image for larger version. 

Name:	Transactions1.JPG 
Views:	17 
Size:	133.0 KB 
ID:	35221
    But….

    Form Properties
    Split Form Datasheet - Allow Edits

    AllowAdditions - No
    Allow Edits –No
    AllowDeletions – No

    Add Recordbutton code
    Private SubcmdAdd_Click()
    On ErrorGoTo ErrorHandler
    Me.AllowAdditions= True
    Me.AllowEdits= True
    DoCmd.GoToRecord , "", acNewRec
    Me.Entry_Title.SetFocus
    Call Button_Control(False, False, True, False,False, True, True, False, True)
    'Errorhandling
    ErrorHandlerExit:
    Exit Sub
    ErrorHandler:
    strFormProc= strModule & "/cmd_Add_Click"
    CallLogError(strFormProc)
    Resume ErrorHandlerExit
    End Sub
    Click image for larger version. 

Name:	Transactions2.JPG 
Views:	17 
Size:	134.7 KB 
ID:	35222


    Does notwork – The Form just ‘locks’ all controls are inaccessible, the SetFocus command does not operate, only the ‘CloseForm’ button actually works!!.
    I have noticed that a whilst a ‘new’ empty record isgenerated in the form view i.e. a set of blank fields, no new line,coloured blue, is generated in the datasheet view.

    I don't think this is me unless I am missing another Property which needs to be set in code.

    Thanks for your help

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Suggest that you start here if you are not completely aware of the settings and their interaction with each other. Perhaps you should be using Data Entry property in some situations, or a snapshot recordset.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    jcc285 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2014
    Posts
    70
    Thank you for a most unhelpful response!!

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Ok. I will quit trying to help you since you find it so aggravating.

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    We probably need to see the code behind the procedure that the posted code calls (Button_Control) to see what it does.

    Also, I guess, behind the procedure CallLogError...or is that supposed to be

    Code:
    Call LogError


    with the space? If the latter, first correct that and see what happens.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    It's a bit hard to judge whether your code syntax is OK, since it seems to be not pasted from actual code, and is not using the forum tags.

    I would comment out the ON ERROR GOTO line while debugging. Try it and see if it shows an error like "Unable to to to specified record" or some such...

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

Similar Threads

  1. Replies: 4
    Last Post: 11-09-2017, 09:10 AM
  2. Replies: 6
    Last Post: 05-09-2017, 09:13 AM
  3. Replies: 7
    Last Post: 07-25-2012, 11:28 AM
  4. Replies: 2
    Last Post: 02-27-2012, 03:02 PM
  5. Replies: 2
    Last Post: 01-01-2012, 09:32 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