subform query - keep getting a parameter

G

Guest

Hi anyone who can help

I have a form that has a subform.

The parent form is a orderform and the subform acts as orderlines for the
order form. In the subform I have a field that list all item numbers in the
stock table.
What I want to do is to say to that field, only show me the item no.s for
the supplier no. on the parent form(main form) that is displayed above you.

For this field in the subform that shows the item no.s, in the row source,
the sql was:
SELECT Stock.stockNo FROM Stock ORDER BY Stock.stockNo;
This just lists all the stockno.s
The next bit was added and it keeps bring up a parameter box, which I dont
want I just want it to get the value from the field and give me the items for
that:
SELECT Stock.stockNo, Stock.supplierNo
FROM Stock
WHERE Stock.supplierNo = txtSupNo
ORDER BY Stock.stockNo;

Can anyone help with this, the txtSupNo is the field that has the supplierNo
I want it to look at and then only display in the field in subform the items
for that supplier.

Thanks in advance.
 
V

Van T. Dinh

I think the Subform is not aware of the Control on the Main Form.

You need to use:

Forms!MainForm!txtSupNo

You can also try:

[Parent]!txtSupNo
 
G

Guest

Thanks!!

Thought it would need to have form! etc but when tried it kept giving
parameter for it... but works a treat now... maybe the fact it was 2.30am may
have has something to do with it ;o)

Thanks again!


Van T. Dinh said:
I think the Subform is not aware of the Control on the Main Form.

You need to use:

Forms!MainForm!txtSupNo

You can also try:

[Parent]!txtSupNo

--
HTH
Van T. Dinh
MVP (Access)



Saj said:
Hi anyone who can help

I have a form that has a subform.

The parent form is a orderform and the subform acts as orderlines for the
order form. In the subform I have a field that list all item numbers in
the
stock table.
What I want to do is to say to that field, only show me the item no.s for
the supplier no. on the parent form(main form) that is displayed above
you.

For this field in the subform that shows the item no.s, in the row source,
the sql was:
SELECT Stock.stockNo FROM Stock ORDER BY Stock.stockNo;
This just lists all the stockno.s
The next bit was added and it keeps bring up a parameter box, which I dont
want I just want it to get the value from the field and give me the items
for
that:
SELECT Stock.stockNo, Stock.supplierNo
FROM Stock
WHERE Stock.supplierNo = txtSupNo
ORDER BY Stock.stockNo;

Can anyone help with this, the txtSupNo is the field that has the
supplierNo
I want it to look at and then only display in the field in subform the
items
for that supplier.

Thanks in advance.
 

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