Select a record from Datasheet view

  • Thread starter Thread starter Lin
  • Start date Start date
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
 
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
 
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
 
Back
Top