Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Join key


Message #1 by "Andrew Payne" <andrewpayne.plastics@b...> on Wed, 27 Feb 2002 14:51:18
Hi



I've made a form called frmNewQuotes, this has fields from 2 tables, 

tblCustomers and tblQuotes.  I created the form using the wizard then made 

all the fields unbound so that data entered into them won't affect the 

table until i want them to.  I created a command button and put code 

behind it to save the the data and close the form, the code consists of 

lines such as:



        Form_frmNewQuotes!CustomerName = txtCustName



to get the data into the fields, and a line saying:



        DoCmd.Close acForm, "frmNewQuotes", acSaveYes



which closes the form and saves the data.  This method has worked on 

another form with no problems, but on the frmNewQuotes when i click on the 

command button to save the new quote an error message comes up saying:



   Cannot add record(s); join key of table 'tblQuotes' not in recordset



Could someone please help



thanks in advance 

Andrew
Message #2 by Barry Martin Dancis <bdancis@c...> on Wed, 27 Feb 2002 11:49:32 -0500
Andrew,

    The form sounds like a master-child relationship. Were your other forms

also of this kind or did they each have only a single table? Before the

children (i.e. tblQuotes) can be saved, the master (tblCustomers)  must be

created and the resulting Id of the new master record placed in the

Customer_Id of the child. I don't know if access can do this automatically.

If not, you may need to have a form for the master containing a subform with

the child records and do the saves separately.



Barry



----- Original Message -----

From: "Andrew Payne" <andrewpayne.plastics@b...>

To: "Access" <access@p...>

Sent: Wednesday, February 27, 2002 9:51 AM

Subject: [access] Join key





> Hi

>

> I've made a form called frmNewQuotes, this has fields from 2 tables,

> tblCustomers and tblQuotes.  I created the form using the wizard then made

> all the fields unbound so that data entered into them won't affect the

> table until i want them to.  I created a command button and put code

> behind it to save the the data and close the form, the code consists of

> lines such as:

>

>         Form_frmNewQuotes!CustomerName = txtCustName

>

> to get the data into the fields, and a line saying:

>

>         DoCmd.Close acForm, "frmNewQuotes", acSaveYes

>

> which closes the form and saves the data.  This method has worked on

> another form with no problems, but on the frmNewQuotes when i click on the

> command button to save the new quote an error message comes up saying:

>

>    Cannot add record(s); join key of table 'tblQuotes' not in recordset

>

> Could someone please help

>

> thanks in advance

> Andrew




>



Message #3 by "Andrew Payne" <andrewpayne.plastics@b...> on Wed, 27 Feb 2002 17:04:18
Barry,

     Thanks for pointing out the master-child relationships, no the other 

forms weren't.  Unless somebody knows of another solution i'll just have 

to recreate the form.



> Andrew,

>     The form sounds like a master-child relationship. Were your other 

forms

> also of this kind or did they each have only a single table? Before the

> children (i.e. tblQuotes) can be saved, the master (tblCustomers)  must 

be

> created and the resulting Id of the new master record placed in the

> Customer_Id of the child. I don't know if access can do this 

automatically.

> If not, you may need to have a form for the master containing a subform 

with

> the child records and do the saves separately.

> 

> Barry

> 

> ----- Original Message -----

> From: "Andrew Payne" <andrewpayne.plastics@b...>

> To: "Access" <access@p...>

> Sent: Wednesday, February 27, 2002 9:51 AM

> Subject: [access] Join key

> 

> 

> > Hi

> >

> > I've made a form called frmNewQuotes, this has fields from 2 tables,

> > tblCustomers and tblQuotes.  I created the form using the wizard then 

made

> > all the fields unbound so that data entered into them won't affect the

> > table until i want them to.  I created a command button and put code

> > behind it to save the the data and close the form, the code consists of

> > lines such as:

> >

> >         Form_frmNewQuotes!CustomerName = txtCustName

> >

> > to get the data into the fields, and a line saying:

> >

> >         DoCmd.Close acForm, "frmNewQuotes", acSaveYes

> >

> > which closes the form and saves the data.  This method has worked on

> > another form with no problems, but on the frmNewQuotes when i click on 

the

> > command button to save the new quote an error message comes up saying:

> >

> >    Cannot add record(s); join key of table 'tblQuotes' not in recordset

> >

> > Could someone please help

> >

> > thanks in advance

> > Andrew




> >

> 


  Return to Index