1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access 2000 Form/Sub-form

Discussion in 'Business Applications' started by nwinchel, Dec 20, 2001.

Thread Status:
Not open for further replies.
Advertisement
  1. nwinchel

    nwinchel Thread Starter

    Joined:
    Mar 19, 2001
    Messages:
    59
    This ought to be pretty simple to do. I have a small table that contains contact information for a number of businesses: name, address, etc. I have an “ID” field that is an auto number and is the PK. I have created another table that contains the business name, date of a donation and a memo field to hold the donation info (since it’s stuff instead of money.) In the second table, “ID” field is also an auto number and is PK. I have related the tables with a one to many: theoretically one business with many possible dates/donations which is the basic premise. I created a main form to input the business data and created a sub-form for the donation data based on their respective tables. Each business will be unique but a business may give multiple donations, say one each month or more – whatever.

    I can’t get it to work. I’ve got that big, honkin’ Access 2000 Developer’s Handbook but am still getting up to speed using it…. but I’ll keep looking until I hear from someone! :D

    Thanks.
     
  2. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    "I can't get it to work"

    What does that mean, Nancy? Are you getting an error; can't figure out how to put it together, or what?

    Did you open the main form in design view, then drag the subform onto (presumably) the bottom of the main form?
     
  3. nwinchel

    nwinchel Thread Starter

    Joined:
    Mar 19, 2001
    Messages:
    59
    I apologize for not being more clear. Yes, I opened the main form in design view and dragged the subform onto it. According to the book I referenced I should have been presented with a Wizard but that did not happen.

    When I try to enter data into the subform, say, an additional donation for a business already listed, I get the following error:

    "You cannot add or change a record because a related record is required in table 'BusinessContactInfo'"

    My form/subform works great with a new or initial business contact and donation. The problem is when I want to add a subsequent donation to an already-listed business.
     
  4. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    Do you have your wizards installed? It's fairly common for people to find out that they don't.
     
  5. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Is the record source for the main form defined? Sounds like your one-to-many relationship is going the wrong way because it is thinking it needs to add a record to the 'BusinessContactInfo' table also. In your sub form is there a parent-child relationship?
     
  6. Guy

    Guy

    Joined:
    Feb 19, 1999
    Messages:
    260
    What two colums are being related to each other in the one-to-many relationship? It sounds like you wna the ID fields related but that will not work if they are both autonumber. What you may need to do is add a column to your subtable called "Link_ID" or similar and make it number format, and indexed with duplicates allowed. You can then select both the link_ID field and the ID field in the subtable's design view and make them primary keys.

    On your main form, check your subform's properties. The "Link Child Field" property should be "Link_ID", and the "Link Master Field" property should be "ID"

    Test this out and let know how it works.

    - Guy
     
  7. nwinchel

    nwinchel Thread Starter

    Joined:
    Mar 19, 2001
    Messages:
    59
    Thank you for your help. I apologize for not getting back to you due to illness and the holidays. Yes, this solution worked nicely and I have added your advice to my ever-growing file of "Access Nuggets"!
     
  8. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    Are your Access nuggets pure Access or do they also include by-products?

    LOL
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/62397

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice