Pop up form coding question

G

gianni_sacco

I have a continuous form that has the following three
items in the detail area:

SalesOrderNo - Customer - SpecialServices

SpecialServices is a command button that brings up a popup
form with about 30 check boxes on it - the idea being that
if special services are applicable to this line item in
the detail area, they can be populated through the popup
form.

I need the query underlying the popup form to reference
the line item in the main form that is current at the
moment the popup form is summoned.

The SpecialServices table has a FK of SalesOrderNo, so I
tried putting in a WHERE clause stipulating WHERE
SalesOrderNo = [Forms].[MyForm].[SalesOrderNo], but it
doesn't seem to be working. I'm assuming this is because
there are scads of SalesOrderNo's referenced in the detail
section and it doesn't know which one to use. I need it to
use the one for the record that is *currently* active.

Thanks!
 
P

PC Datasheet

SalesOrderNo is not the field to use! You need to use the primary key of the
Details table. Assuming the PK is SalesOrderDetailID, put this code in the
OnClick event of the command button:

DoCmd.OpenForm "NameOfPopupForm",,,"[SalesOrderDetailID] = " &
Me!SalesOrderDetailID
 

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