Results 1 to 5 of 5
  1. #1
    MichealShinn is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    24

    I can't enter data into a subform

    Guys,



    Hi. Thanks for your help.

    I haven't used subforms before, and I'm missing something here. I have a table named Customers. One customer can have more than one account number. I have a second table named Account Numbers. I've set up a one-to-many relationship with Referential Integrity enforced. I created a form to enter new Customers and another form to enter account numbers. I put the Account Numbers form onto the data entry form for new customers as a subform. When people are just browsing, they can see the Customers and the Account Numbers that that Customer has, but when somebody is entering a new Customer, they can't get into the Account Numbers subform to enter Account Numbers.

    I'm obviously missing a crucial step here. Does anybody know what it is?

    Thanks again for your help.

    Micheal

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    What's happening is that if there are no existing account records for a customer, then the subform will be blank - not even a blank record. What you have to do in this case is change the properties of the subform to Dataentry = Yes.

    If new_customer then
    me!SubformControl.Form.Dataentry = True
    endif

    new_customer is whatever criteria you use to determine when data for a new customer is being added.

    Notice that in me!SubformControl.Form.Dataentry you don't use the name of the subform - you use the name of the control that contains the subform.

    HTH

    John

  3. #3
    MichealShinn is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    24
    John,

    Thanks for your reply.

    I already have Data Entry = Y in the properties of both the main form and the subform. Where do I put the code to check to see if the main form has data for a new record in it?

    Thanks.

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Check the Allow Additions property - it has to be set True as well.

    John

  5. #5
    MichealShinn is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    24
    That did it. Thank you very much.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-28-2012, 09:39 AM
  2. Can't use data access pages to enter data
    By ellie1 in forum Access
    Replies: 2
    Last Post: 04-21-2012, 12:32 AM
  3. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  4. Enter parameter value (subform combo)
    By AndycompanyZ in forum Queries
    Replies: 11
    Last Post: 06-22-2011, 08:33 AM
  5. Replies: 0
    Last Post: 10-12-2010, 06:08 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