Good evening,
I am creating a form with the ability to display a random sample sized based on the user input in a textfield. Eg. User specifies they want 3 samples from a customers table; a random sample of 3 are shown as a query result.
I am having difficulty determining exactly why my code is failing and fails to produce any results:
Code:
Private Sub Command0_Click()
Dim strSQL As String
strSQL = "SELECT TOP " & Me.RandomNumberInput & " *" _
& "FROM (SELECT Rnd(CustomerID) " _
& "AS RandomValue, * " _
& "FROM tCustomers) " _
& "AS [%$##@_Alias] " _
& "ORDER BY [%$##@_Alias].RandomValue;"
Me.RecordSource = strSQL
End Sub
Thanks so much!
-k