Thanks pBaldy i appreciate you taking time to help
I have another question in regards to your potential normalization comment
I have 3 lists i want to populate with records from 3 seperate tables, 1 list for each table (tblWeapons, tblArmour and tblVehicles) i have one query to manipulate all 3 tables and was hoping to use 1 function to load each list from there respective tables with a variable in place of the Weapons,Armour and Vehicles part of the code.
This is Non normalization?
This is my code so far
Private Sub Main()
CurrentDb.Execute "UPDATE tblWeapons SET Include = False"
Dim total As Long
Dim CountListHeight, CountAttack
Do Until rs.EOF
CountListHeight = CountListHeight + 1
total = total + rs("No")
rs.Edit
Select Case total
Case Is < 501
rs("Include") = rs("No")
CountAttack = CountAttack + (rs(sQry) * rs("Include"))
rs.Update
Case 501
rs("Include") = rs("No")
rs.Update
CountAttack = CountAttack + (rs(sQry) * rs("Include"))
Exit Do
Case Is > 501
total = total - 501
rs("Include") = (rs("No") - total)
rs.Update
CountAttack = CountAttack + (rs(sQry) * rs("Include"))
Exit Do
End Select
rs.MoveNext
Loop
Set rs = Nothing
Me.WeaponsList.Height = CountListHeight * 260.8
Me.Text8.value = CountAttack
End Sub
Private Sub ListAttackDesc_Click()
sQry = "Attack"
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblWeapons ORDER BY Attack DESC")
Main
Me.WeaponsList.RowSource = "SELECT tblWeapons.Name, tblWeapons.Attack, tblWeapons.Defence, tblWeapons.Include FROM tblWeapons WHERE (((tblWeapons.Include)=True)) ORDER BY tblWeapons.Attack DESC;"
WepNo2Label.Caption = "Att"
WepNo2Label.Caption = "Def"
TotalLabel.Caption = "Total Attack"
End Sub