Open form by doubleclicking in subform-datasheet

  • Thread starter Thread starter haukalid
  • Start date Start date
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
 
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] & "'"
 
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
 
Back
Top