Results 1 to 4 of 4
  1. #1
    david.paige is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    2

    Create new record in subform

    I am having a problem with Access 2003 creating a new record using a subform. Let's just call the database house. The main table has fields for item number (primary key), description, etc.



    The related tables have a 1-to-1 relationship to the item number. It has fields like Applicable (True/False), and Quantity. I created three separate tables for each building, displayed in a subform from the main table. I want to have a record with zero quantity if I don't need the item right now.

    The problem I am having is that when I add a new item to the main table, the subforms don't always save. I have the subforms default to True, and even added an autonumber field. The subforms populate with data from the main table (item number, description, etc.), but when I click the button to go to the next record, it doesn't create the record in the related table.

    The only reliable way I have found to create the records is to set the Quantity value to something, click the button to go to another record, and then go back and delete the Quantity. I thought having a logical value set to true, or an autonumber value would cause the record to get created.

    One additional thing. I have the navigation borders removed for my subforms, so that I can't click each one individually. But, if enter a quantity for each subform, all of them will be created. If I don't enter anything (i.e., only the logical box is checked), it doesn't create the record.

    What am I doing wrong? Why won't the autonumber and logical True values cause the records to be created?

    Thanks.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Default values and AutoNumbers do *not* dirty a record. You would need to dirty the record in the SubForm for it to save automatically. BTW, 1:1 relationships are unusual in a RDBMS.

  3. #3
    Grooz13 is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    97
    in small db, sometimes I create "Creation Field" in wich i put automaticly à 0 in the vb code... it will records since it will contain an information

  4. #4
    david.paige is offline Novice
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    2
    Thanks for the quick reply. I'll read up on how to dirty a record,and play with a bit. Maybe I can create a script to dirty the record when it displays.

    I went the 1:1 route because I have a known number of "houses." I keep the item description and serial number in the main table, and have a table for each "house." Either the house has a wetbar/fireplace/garage or it doesn't. If it does, then it's that specific model.

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

Similar Threads

  1. Replies: 6
    Last Post: 07-16-2010, 10:25 AM
  2. Replies: 5
    Last Post: 06-29-2010, 01:24 PM
  3. Create combo search form in subform
    By grant.smalley in forum Forms
    Replies: 6
    Last Post: 02-19-2010, 04:37 AM
  4. Create PDF for each record in table/form
    By ChrisCMU in forum Forms
    Replies: 15
    Last Post: 07-28-2009, 01:52 PM
  5. create word documet for each record
    By datto in forum Programming
    Replies: 0
    Last Post: 02-11-2007, 06:57 AM

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