Hi All -
I need some direction. I don't know to much about programing or adding code to MS Access.
I need to create a report containing a specific number of randomized records from each catagory. However I do not know which way to go with this.
I have tried vb coding within the report but it doesn't run. I tried top records in queries.
Some direction is needed.
When I go to run the report I get a runtime error 424.
Here is my code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'initialize ASP RND() function
Randomize (5)
intRandomNumber = Int(1000 * Rnd) + 1
'Return 15 random records
strSQL = _
"SELECT TOP 5 INVENTORY_1,CHEESE, RND(" & -1 * (intRandomNumber) & "*Catagory)" & _
"FROM INVENTORY_1 " & _
"CATAGORY BY 5"
Set objRS = objConn.Execute(strSQL)
End Sub
It stops on Set objRS = objConn.Execute(strSQL)
I need some direction. I don't know to much about programing or adding code to MS Access.
I need to create a report containing a specific number of randomized records from each catagory. However I do not know which way to go with this.
I have tried vb coding within the report but it doesn't run. I tried top records in queries.
Some direction is needed.
When I go to run the report I get a runtime error 424.
Here is my code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'initialize ASP RND() function
Randomize (5)
intRandomNumber = Int(1000 * Rnd) + 1
'Return 15 random records
strSQL = _
"SELECT TOP 5 INVENTORY_1,CHEESE, RND(" & -1 * (intRandomNumber) & "*Catagory)" & _
"FROM INVENTORY_1 " & _
"CATAGORY BY 5"
Set objRS = objConn.Execute(strSQL)
End Sub
It stops on Set objRS = objConn.Execute(strSQL)