Select a record from Datasheet view

L

Lin

Hi,

I have a main form with subform. Subform is in Datsheet view. Subform is a
list of courses what a certain student attended in the past. I would like to
select a specific record from the datsheetview and view the detials in the
main form.How dcan I accoplish this using code. any help really apprciate.

Thanks,

Lin
 
F

Francisco

Hi Lin,

If you want to accomplish this you might want to use a list box instead of a
subform it will be easier.

Here is the code to fill the list box I put it on the On Current event of
the form. As far the details that you want to view on the form I am not
quite sure what do you want to do. For this example I am using the Northwind
database. I hope this helps.


Private Sub Form_Current()
Dim strSQL As String

strSQL = "SELECT A.ProductName, B.Quantity, B.UnitPrice, B.Discount " _
& "FROM Products A " _
& "INNER JOIN [Order Details] B " _
& "ON A.ProductID = B.ProductID " _
& "WHERE B.OrderID = " & OrderID

lstOrderDetails.RowSource = strSQL
End Sub
 
C

Clifford Bass

Hi Lin,

Use the On Current and/or the On Click events of the subform. In those
you can then tell the main form to reposition, perhaps using the
DoCmd.FindRecord command.

Clifford Bass
 

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