L
LisaInAz
I tried to research and I am not sure if I should start a new thread in a
different forum (I found Select N when N is a variable but couldn't get it to
work)
I would like to pass the number of records that I need for each unique
entity via form/table, below is the SQL that is working however, I have 36
different entities where I need to randomly select X data (for example I
would like to pass 1883) I don't need to necessarily SELECT TOP if I could
figure out how add to/subtract from a counter for random selection . <using
SQL server
is not an option; we are using Access 2002 SP3>...
SELECT TOP 1883 Rnd([CountNum]) AS RandomValue, tbl002_F1BWDATA.CountNum,
tbl002_F1BWDATA.Unique, tbl002_F1BWDATA.UniqueTwo, tbl002_F1BWDATA.DISTRICT,
tbl002_F1BWDATA.ELIG, tbl002_F1BWDATA.PRIM_ID INTO tbl003C_F1BWDATA
FROM tbl002_F1BWDATA
WHERE (((randomizer())=0))
ORDER BY Rnd([CountNum]) DESC;
I have found a few items
Such as
Dim intRecCount As Integer
intRecCount = DCount("*", "tblTest")
&
****************
Private Function TopParameter()
Dim dbf As Database, qdf As QueryDef, strSQL As String, strSQL1 As String
Set dbs = CurrentDb
On Error Resume Next
DoCmd.DeleteObject acQuery, "ListTop"
strSQL = "SELECT TOP " & [Forms]![frmSelectVendors]![txtTopCount] & "
tblVendors.VendorID, tblVendors.VendorName,
qryPerformanceDetailExtCost.ExtCost"
Set dbf = DBEngine.Workspaces(0).Databases(0)
Set qdf = dbf.CreateQueryDef("ListTop", strSQL)
End Function
However, my knowledge is limited and I can not get them to work...
Thanks for your help in advance
different forum (I found Select N when N is a variable but couldn't get it to
work)
I would like to pass the number of records that I need for each unique
entity via form/table, below is the SQL that is working however, I have 36
different entities where I need to randomly select X data (for example I
would like to pass 1883) I don't need to necessarily SELECT TOP if I could
figure out how add to/subtract from a counter for random selection . <using
SQL server
is not an option; we are using Access 2002 SP3>...
SELECT TOP 1883 Rnd([CountNum]) AS RandomValue, tbl002_F1BWDATA.CountNum,
tbl002_F1BWDATA.Unique, tbl002_F1BWDATA.UniqueTwo, tbl002_F1BWDATA.DISTRICT,
tbl002_F1BWDATA.ELIG, tbl002_F1BWDATA.PRIM_ID INTO tbl003C_F1BWDATA
FROM tbl002_F1BWDATA
WHERE (((randomizer())=0))
ORDER BY Rnd([CountNum]) DESC;
I have found a few items
Such as
Dim intRecCount As Integer
intRecCount = DCount("*", "tblTest")
&
****************
Private Function TopParameter()
Dim dbf As Database, qdf As QueryDef, strSQL As String, strSQL1 As String
Set dbs = CurrentDb
On Error Resume Next
DoCmd.DeleteObject acQuery, "ListTop"
strSQL = "SELECT TOP " & [Forms]![frmSelectVendors]![txtTopCount] & "
tblVendors.VendorID, tblVendors.VendorName,
qryPerformanceDetailExtCost.ExtCost"
Set dbf = DBEngine.Workspaces(0).Databases(0)
Set qdf = dbf.CreateQueryDef("ListTop", strSQL)
End Function
However, my knowledge is limited and I can not get them to work...
Thanks for your help in advance