C
CW
No, I'm not looking for a shrink or an agony aunt...although I may well need
one soon if this carries on...
I have been struggling with how to construct the table relationships in
order to support the creation of invoices, which I do in three stages. I am
aware that nobody can help unless I describe my app clearly enough and I'll
try to summarise it as follows:
tblInquiries holds numerous client details including Name and Ref. These are
maintained via frmMain.
tblInvoices includes InvNo, InvDate, DebtorName, Ref. I have a one to many
relationship from tblInquiries.Ref to tblInvoices.Ref (because several
invoices may be required on an order)
tblDebtors includes DebtorName, DebtorAccountNo, InvNo. I have a one to
many relationship from tblInvoices.InvNo to tblDebtors.InvNo (but have a
sneaky feeling this may be wrong!)
tblInvoiceLines contains InvNo and a number of fields carrying the service
descriptions and the charges etc. I have a one to many relationship from
tblInvoices.InvNo to tblInvoiceLines.InvNo (because of course each invoice
can contain several lines)
From my Main form I have a button that opens frmInvoiceHeader (record source
tblInvoices) and this allocates the invoice number, and has controls for the
date, and the order Ref (pushed from frmMain).
From there I fire another button and open frmInvoiceDebtor (record source
tblDebtors) on which I have a combo to select the required Debtor (with
address etc). The InvNo is pushed from frmInvoiceHeader, creating the link
between the two.
Then I fire another button to open frmInvoiceLines, (record source
tblInvoiceLines) again pushing the InvNo through to complete the link between
all three forms/tables.
This mostly appears to work OK but there are two problems:
1: When I open frmInvoiceDebtor the newly created InvNo has been pushed
through OK. However, if I then use the combo and select a Debtor that has
already had an invoice created against them, the pre-filled InvNo is erased
and has to be re-entered manually.
2. When I run my qryInvoices which captures everything from all 3 linked
tables/forms, sorted by InvNo, it shows certain invoices twice, firstly with
the "original" debtor and then with the newly selected one.
I'm sure this is caused by an error in my relationships and have tried
various other structures but have now got myself in a loop and cannot fathom
out where I'm going wrong.
If I should be using different fields for the relationships and/or they
should be of different join types, please let me know.
I'm sorry this is so long-winded but hope that someone can understand the
situation and point me in the right direction!
Thanks a lot
CW
one soon if this carries on...
I have been struggling with how to construct the table relationships in
order to support the creation of invoices, which I do in three stages. I am
aware that nobody can help unless I describe my app clearly enough and I'll
try to summarise it as follows:
tblInquiries holds numerous client details including Name and Ref. These are
maintained via frmMain.
tblInvoices includes InvNo, InvDate, DebtorName, Ref. I have a one to many
relationship from tblInquiries.Ref to tblInvoices.Ref (because several
invoices may be required on an order)
tblDebtors includes DebtorName, DebtorAccountNo, InvNo. I have a one to
many relationship from tblInvoices.InvNo to tblDebtors.InvNo (but have a
sneaky feeling this may be wrong!)
tblInvoiceLines contains InvNo and a number of fields carrying the service
descriptions and the charges etc. I have a one to many relationship from
tblInvoices.InvNo to tblInvoiceLines.InvNo (because of course each invoice
can contain several lines)
From my Main form I have a button that opens frmInvoiceHeader (record source
tblInvoices) and this allocates the invoice number, and has controls for the
date, and the order Ref (pushed from frmMain).
From there I fire another button and open frmInvoiceDebtor (record source
tblDebtors) on which I have a combo to select the required Debtor (with
address etc). The InvNo is pushed from frmInvoiceHeader, creating the link
between the two.
Then I fire another button to open frmInvoiceLines, (record source
tblInvoiceLines) again pushing the InvNo through to complete the link between
all three forms/tables.
This mostly appears to work OK but there are two problems:
1: When I open frmInvoiceDebtor the newly created InvNo has been pushed
through OK. However, if I then use the combo and select a Debtor that has
already had an invoice created against them, the pre-filled InvNo is erased
and has to be re-entered manually.
2. When I run my qryInvoices which captures everything from all 3 linked
tables/forms, sorted by InvNo, it shows certain invoices twice, firstly with
the "original" debtor and then with the newly selected one.
I'm sure this is caused by an error in my relationships and have tried
various other structures but have now got myself in a loop and cannot fathom
out where I'm going wrong.
If I should be using different fields for the relationships and/or they
should be of different join types, please let me know.
I'm sorry this is so long-winded but hope that someone can understand the
situation and point me in the right direction!
Thanks a lot
CW