Access 2010 Adding a new record

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 
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?
 

kazwaz

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

How do I upload the sample db?
 
Joined
Jul 29, 2001
Messages
21,334
Put it in a zip file and click the Go Advanced button and attach file.
 

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.
 
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.
 

Attachments

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
 
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.
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Members online

Top