Open form by doubleclicking in subform-datasheet

H

haukalid

A have a form (frmOrderOiew) used to get an overview over orders per
customer. I'm using an unbound control to choose the customers. And in a
subform on the same form the orders are listed in datasheet-view when a
customer is selected. I would like to be able to doubleclick on an order in
the subform and have this one opened up in another form (frmSingleOrder) with
all the details for this order.

I've made an OnDoubleClick event on the Subfrom:
DoCmd.OpenForm "frmSingleOrder",,,"[orderID]" = "
&Forms![frmSingleOrder]![orderID]"

But I'm getting an errormessage "Run-time error '3008'" Saying that an table
named "Diagnosis" is open...and so on...

Should there be done anything with the recordset? I can't figure out how to
get on with this one.

Mvh Rolf
 
D

Douglas J. Steele

Not sure whether this is the problem, but your quotes are incorrect.

DoCmd.OpenForm "frmSingleOrder",,,"[orderID] = " &
Forms![frmSingleOrder]![orderID]

That assumes that orderID is a numeric field. If it's text, you need

DoCmd.OpenForm "frmSingleOrder",,,"[orderID] = '" &
Forms![frmSingleOrder]![orderID] & "'"
 
H

haukalid

Thanks for your reply! You solved a part of the problem. But now I got an
Runtimeerror 2450 saying that it can't find the form frmSingleOrder. I've
crosschecked multiple times and the spelling of the form is correct.

---------------------------------


Douglas J. Steele skrev:
Not sure whether this is the problem, but your quotes are incorrect.

DoCmd.OpenForm "frmSingleOrder",,,"[orderID] = " &
Forms![frmSingleOrder]![orderID]

That assumes that orderID is a numeric field. If it's text, you need

DoCmd.OpenForm "frmSingleOrder",,,"[orderID] = '" &
Forms![frmSingleOrder]![orderID] & "'"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


haukalid said:
A have a form (frmOrderOiew) used to get an overview over orders per
customer. I'm using an unbound control to choose the customers. And in a
subform on the same form the orders are listed in datasheet-view when a
customer is selected. I would like to be able to doubleclick on an order
in
the subform and have this one opened up in another form (frmSingleOrder)
with
all the details for this order.

I've made an OnDoubleClick event on the Subfrom:
DoCmd.OpenForm "frmSingleOrder",,,"[orderID]" = "
&Forms![frmSingleOrder]![orderID]"

But I'm getting an errormessage "Run-time error '3008'" Saying that an
table
named "Diagnosis" is open...and so on...

Should there be done anything with the recordset? I can't figure out how
to
get on with this one.

Mvh Rolf
 

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