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 2010 Adding a new record

Discussion in 'Business Applications' started by kazwaz, Dec 2, 2011.

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

    kazwaz Thread Starter

    Joined:
    Jun 29, 2011
    Messages:
    98
    I realise that the subject seems a bit obvious, but what I am trying to do is -

    Scenario first...
    I have a main form with a primary key QuoteRef which contains the details of people requesting a quotation. Each enquiry has the potential to have variations of product on the same quote e.g. storage container to buy or storage container to hire. So I have created a second table with a primary key, lets call it ContainerID and this table has QuoteRef as its foreign key linked via a one to many relationship.

    The main form has a button that opens a second form based on the second table but the QuoteRef is pulled through so that the details in the second form are related to the person's details in the main form. So far so good...

    What I would like is someway to add another record to this second table/form but still have it related to the person's details from the first record. I know it can be done using a sub form on the main form but I'm trying to make the actual data entry more user friendly. I tried creating a button using the wizard but this just creates an embedded macro and I can't find a way to edit it in VB.

    I think I need code along the lines of

    Forms![frmContainerRequirements]![QuoteRef] = Forms![frmContactDetails]![QuoteRef]

    where frmContainerRequirements is the second form and frmContactDetails is the main one.

    Sorry for being a bit long winded or confusing but I hope someone here can help me.
    Thanks
    Karen
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    The data of course would have to be added to a table as a form just displays the underlying data. Do you have a sample db you can post?
     
  3. kazwaz

    kazwaz Thread Starter

    Joined:
    Jun 29, 2011
    Messages:
    98
    The data is in two tables
    tblContactDetails
    tblContainerRequirements

    How do I upload the sample db?
     
  4. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Put it in a zip file and click the Go Advanced button and attach file.
     
  5. kazwaz

    kazwaz Thread Starter

    Joined:
    Jun 29, 2011
    Messages:
    98
    Sample attached...
    Thanks
     

    Attached Files:

  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Karen, I can't understand your reluctance to use a Subform. It is the standard and perfect way to keep the data related.
     
  7. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    You could do this a couple of ways, but I just used the onLoad event for the opening form to make the QuoteRef field equal what was open on the main form.
     

    Attached Files:

  8. kazwaz

    kazwaz Thread Starter

    Joined:
    Jun 29, 2011
    Messages:
    98
    Apologies for taking so long to get back to this.
    I'm not sure how using the onLoad property would work as the form is already open. You mentioned there were a couple of ways. Would you mind explaining the other one?
    Thanks
    Karen
     
  9. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    No it would not already be open. You click the button to add container details and populate the fields with that onLoad event.
     
  10. kazwaz

    kazwaz Thread Starter

    Joined:
    Jun 29, 2011
    Messages:
    98
    Hi,
    Sorry for the delay in replying. I've had to go back to the drawing board with this as the output from the data doesn't do what I want with Word Automation. But thanks for the help.
    Karen
     
  11. 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/1029344

  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