query in subform

W

Wayne

Ok...here's what I have.

I have a main form called PrintRequisition with a subform
called PrintReq_Subform. The subform contains a combo
called Type that gets its values from the following query:

SELECT Print_Type.PrintTypeID, Print_Type.PrintType FROM
Print_Type;

There is another combo called PaperSize with the following
query as the rowsource:

SELECT Print_Fee.PrintFeeID, Print_Fee.PrintTypeID,
Print_Fee.PaperSize FROM Print_Fee WHERE
(((Print_Fee.PrintTypeID)=[Forms]![PrintRequisition]![PrintReq_Subform]![Type]));

And I have Me!PaperSize.Requery on the got focus event of
the PrintSize combo.

So what's supposed to happen is this. I select a print type
from the Type combo and then when I select the PrintSize
combo it only displays the values relevant to the print
type selected. This seems to work but when I click into the
next record and select a different value in the Type combo
the requery makes the previously selected values in the
PaperSize combo disapear. The subform is displayed in
Datasheet view, is that part of the problem?

I hope someone can help.

Thanks
 
S

Steve Schapel

Wayne,

I don't know how this works in datasheet view, I have never used a
datasheet view form. But if you make it a continuous view form, try
this... On the Enter event of the PaperSize combobox, put code like this:
Me.PaperSize.RowSource = "SELECT PrintFeeID, PrintTypeID, PaperSize
FROM Print_Fee WHERE PrintTypeID =" & Me.Type
.... and then on the Exit event of the PaperSize combobox:
Me.PaperSize.RowSource = "SELECT PrintFeeID, PrintTypeID, PaperSize
FROM Print_Fee"
 
W

Wayne

Hi

Even with your code the value in the PaperSize field
disapears when I move from that record.
Anyway, I really do need the subform to be in datasheet view.

-----Original Message-----
Wayne,

I don't know how this works in datasheet view, I have never used a
datasheet view form. But if you make it a continuous view form, try
this... On the Enter event of the PaperSize combobox, put code like this:
Me.PaperSize.RowSource = "SELECT PrintFeeID, PrintTypeID, PaperSize
FROM Print_Fee WHERE PrintTypeID =" & Me.Type
.... and then on the Exit event of the PaperSize combobox:
Me.PaperSize.RowSource = "SELECT PrintFeeID, PrintTypeID, PaperSize
FROM Print_Fee"

--
Steve Schapel, Microsoft Access MVP

Ok...here's what I have.

I have a main form called PrintRequisition with a subform
called PrintReq_Subform. The subform contains a combo
called Type that gets its values from the following query:

SELECT Print_Type.PrintTypeID, Print_Type.PrintType FROM
Print_Type;

There is another combo called PaperSize with the following
query as the rowsource:

SELECT Print_Fee.PrintFeeID, Print_Fee.PrintTypeID,
Print_Fee.PaperSize FROM Print_Fee WHERE
(((Print_Fee.PrintTypeID)=[Forms]![PrintRequisition]![PrintReq_Subform]![Type]));

And I have Me!PaperSize.Requery on the got focus event of
the PrintSize combo.

So what's supposed to happen is this. I select a print type
from the Type combo and then when I select the PrintSize
combo it only displays the values relevant to the print
type selected. This seems to work but when I click into the
next record and select a different value in the Type combo
the requery makes the previously selected values in the
PaperSize combo disapear. The subform is displayed in
Datasheet view, is that part of the problem?

I hope someone can help.

Thanks
.
 

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