Open new form from a datasheet

A

angsapurai

I have a form "CustomerForm" that contains a subform
"CustomerOrders" (with datasheet view).
Is it possible to open a new form when the user double clicks on a row
within the datasheet (i.e. CustomerOrders)? This will open a new form
"OrderForm" passing the order ID from the row?
 
B

Brendan Reynolds

I have a form "CustomerForm" that contains a subform
"CustomerOrders" (with datasheet view).
Is it possible to open a new form when the user double clicks on a row
within the datasheet (i.e. CustomerOrders)? This will open a new form
"OrderForm" passing the order ID from the row?

Here's an example that uses the orders subform in the 'Northwind' sample
database.

Private Sub ShowProduct()
DoCmd.OpenForm "Products", , , "ProductID = " & Me.ProductID
End Sub

Private Sub ProductID_DblClick(Cancel As Integer)
ShowProduct
End Sub

This will open the Products form whenever the user double clicks the
'ProductID' control. To open the form when the user double clicks other
controls, call the ShowProduct sub from the DblClick event procedure of
those other controls too, e.g. ...

Private Sub SomeOtherControl_DblClick(Cancel As Integer)
ShowProduct
End Sub
 

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