Making a query to get data from a parent-child table

G

grupy

Hello

Im quite new to VBA coding with MS Access and may do things that most of yo
wouldnt so I would appreciate any further insight into question if you
willin
to provide it

Im creating a system for my cousin so he can basically create invoices for hi
company. His company has 2 different mailing addresses so I have used a tabl
(tblCompany) to store this information

The main data is stored on a parent (Client) and child (Product) table. Whe

open the parent table, I can view all the products that were shipped to th
particular client. This works great

The portion that doesnt work great is when I try to create an Invoice throug

Report. I created a form, called frmInvoice, that is being used to gather th
criteria for the invoice and this is when I run into a problem; well a few t
b
honest



I created a form, frmInvoice, that allows him to select the company he want
b
a selection button and I create a temp table to store the query results.
Probably not the best idea, but it does work

On the same form, I have a combo box that allows him to select the paren
tabl
(client) information only and not the child information (products). I stor
th
parent (client) information into another temp table. This works, but probabl
not the best coding method being used

The final section is a date where he has to enter the starting and end date
an
this will create a filter to only display certain products sold between thos
dates to the particular client that was selected above

Im wondering if I can simply make a query to either create a temp table o
stor
data from the parent-child tables. I would like to simply allow my cousin t
select the client he delivers to from the combo box and when he clicks on
button to confirm the client, it will pull the clients information and thei
respective orders into a query or another table, similiar to how I can vie
th
current parent-child relationship but only for that particular client

From there, I would like to basically re-filter that data with the date
entere
into two text boxes (start and end date) so the data will reflect the dates h
wants to print his invoices for. For this I have created another button tha
would basically start the filtering process. I believe I have the proper cod
for this, so this isnt the big issue its mainly getting the data I require t
filter

Any help into this would be greatly appreciated as Im searched a number o
places and cant find any help and thought I would try here

Pls help.
 
G

grupy

grupy wrote on 05/27/2010 16:20 ET
Hello

Im quite new to VBA coding with MS Access and may do things that most of yo
wouldnt so I would appreciate any further insight into question if you willin
to provide it

Im creating a system for my cousin so he can basically create invoices fo hi
company. His company has 2 different mailing addresses so I have used tabl
(tblCompany) to store this information

The main data is stored on a parent (Client) and child (Product) table. Whe
open the parent table, I can view all the products that were shipped to th
particular client. This works great

The portion that doesnt work great is when I try to create an Invoice throug
Report. I created a form, called frmInvoice, that is being used to gathe th
criteria for the invoice and this is when I run into a problem; well a few t
be honest



I created a form, frmInvoice, that allows him to select the company he want b
a selection button and I create a temp table to store the query results
Probably not the best idea, but it does work

On the same form, I have a combo box that allows him to select the paren tabl
(client) information only and not the child information (products). I stor
the parent (client) information into another temp table. This works, bu
probably not the best coding method being used

The final section is a date where he has to enter the starting and end date
and this will create a filter to only display certain products sold betwee
those dates to the particular client that was selected above

Im wondering if I can simply make a query to either create a temp table o
store data from the parent-child tables. I would like to simply allow m
cousin to select the client he delivers to from the combo box and when h
clicks on a button to confirm the client, it will pull the client informatio
and their respective orders into a query or another table, similiar to how
can view the current parent-child relationship but only for that particula
client

From there, I would like to basically re-filter that data with the date
entered into two text boxes (start and end date) so the data will reflect th
dates he wants to print his invoices for. For this I have created anothe
button that would basically start the filtering process. I believe I hav th
proper code for this, so this isnt the big issue its mainly getting the dat
require to filter

Any help into this would be greatly appreciated as Im searched a number o
places and cant find any help and thought I would try here

Pls help
Anyone able to provide an example of code of how I can basically query
parent-child table to pull a specific record from the parent table, includin
its child dependencies??

For example, if you select ProductID 5, you pull all the parent records fo
ProductID = 5 and all child dependencies for that particular record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top