Results 1 to 3 of 3
  1. #1
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010

    Stop subform from creating record

    I've got a subform that's in a datasheet view as it will be a list entry for my user. My problem is when you go into a form, it has an autonumber ID and is related to the Job Number, and so these fields populate. They are Hidden of course cause they aren't what I'm concerned with, so it essentially creates a blank record. When I run reports these of course show up and I don't want them to.

    Is there a way to code this to not create a record until the field is clicked on? Or would a better way to solve this problem be to create a delete query to delete all of the records that are blank in a required field when a report is ran?

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    have you considered the form property of AllowAdditions ?

    another approach depends on the user someone accidentally tabbing into a new record to generate the autoid....that could be controlled with a setfocus command tactically placed at their last control to prevent it from moving forward....

    kind of depends on the user experience.

  3. #3
    eww is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2010
    I hadn't tried the AllowAdditions property, but it looks like it does what I need. For those who might use this in the future, all I did in the vba editor was

    Private Sub Form_Current()
    Me.SubFormName.Form.AllowAdditions = False
    End Sub

    Private Sub SubFormName_Enter()
    Me.SubFormName.Form.AllowAdditions = True
    End Sub

    Simple enough. It disallows any records to be created unless you specifically click into that subform. The only other thing of concern is similar to what you said NTC, it's a list entry type deal, so when they are entering the data, they might go into the next one without actually needing to enter any data.

    My problem with limiting this with a setfocus like you said, is that for the most part I would like it to flow well without having to manually clicking into the fields each time they actually DO want to enter data. I might play around some with the setfocus, or I might just end up putting up a delete query on those that are null in the required spots.

    Once again, thanks for your help NTC.

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

Similar Threads

  1. Stop tab from creating next record.
    By tazbergy in forum Forms
    Replies: 1
    Last Post: 09-12-2010, 04:29 PM
  2. Replies: 5
    Last Post: 06-29-2010, 01:24 PM
  3. Creating a reference to the subform.
    By evander in forum Forms
    Replies: 2
    Last Post: 05-26-2010, 09:39 AM
  4. Replies: 2
    Last Post: 11-29-2009, 12:00 PM
  5. Subform creating new unwanted entries
    By Rpatrick in forum Access
    Replies: 1
    Last Post: 08-14-2009, 03:08 PM

Tags for this Thread

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