dimanche 13 novembre 2016

access vba random value from combobox

i have a combobox of Client codes that links to table - ClientT.

when i click a button randomcmd i would like a random client code to appear in the combobox.

my thought was use VBA code to find the maximum number of clients in ClientT, then Rnd function to pick a number between max and 0, then convert that number to a value from the list.

i just can't find any similar code to use. all i have so far is a number that generates randomly.

Private Sub Randomcmd_Click()

ClientCodecmb = Int(999 * Rnd) + 1

End Sub

please help.




Aucun commentaire:

Enregistrer un commentaire