ms access - Select rows based on 5% of total ticket count per combo of User/Team/Category -


i new world of programming , self-taught. i've read think need code includes use of sub-queries. however, i've never created sub-queries i'm little lost on how accomplish that.

i have table include multiple tickets entered different users specific teams , categories. need count # of tickets per combinations , pull random no of tickets (5 %) based on each combination.

for example combo of smith,saml&cinquiry has 176 tickets, need pull 9 of tickets

the combo of brown,toml&clicensing has 22 tickets, need pull 1 of those.

i attempting in access database.

here's i've tried:

public function test()  set dbs = currentdb  dim newqry querydef  set newqry = dbs.createquerydef(rst2) = 1 i2 = 1  set rst = dbs.openrecordset("query1", dbopendynaset)  until i2 >     rst.move int(rnd(rst.recordcount) * 100)     if i2 = 1       query_filter_store = " combo ='" & rst.combo.value & "'"     else       query_filter_store = query_filter_store & " or " & "combo='" & rst.combo.value & "'"     end if  i2 = i2 + 1  loop  'set rst2 = dbs.openrecordset("select * query1" & query_filter_store)  set rst2 = dbs.createquerydef("test_query", "select * query1 " & query_filter_store) 


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -