Last post Joe, I swear. I'm about to throw this *($)# out the 2nd floor window. Here is the entire code, did I place it where you are telling me -
-------------------------------------
Public mcnn As ADODB.Connection
Private dbs As ADODB.Recordset
Private Sub Command1_Click()
Dim EmplName As String
Dim percent As Long
'Dim Percent As Integer
Dim count As Integer
Dim random As Integer
count = 0
'Commented out 2:13pm >>Percent = (Text1.Text / 100)
percent = Val(Text1.Text)
percent = percent / 100
EmplName = Combo1.Text
Set mcnn = New ADODB.Connection
mcnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\autochooser.mdb ;Persist Security Info=False"
mcnn.Open
Set dbs = New ADODB.Recordset
dbs.CursorType = adOpenKeyset
dbs.LockType = adLockOptimistic
dbs.Source = "SELECT * FROM tblEmployees" & _
"WHERE EmployerName = '" & EmplName & ""
Set dbs.ActiveConnection = mcnn
dbs.Open
percent = Text1.Text / 100
percent = dbs.RecordCount * percent
dbs.Close
mcnn.Close
'Commented out 11:53 >>While Not count = Percent
Do While percent <> count
Randomize
random = (Rnd * 100)
Set mcnn = New ADODB.Connection
mcnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\autochooser.mdb ;Persist Security Info=False"
mcnn.Open
Set dbs = New ADODB.Recordset
dbs.CursorType = adOpenKeyset
dbs.LockType = adLockOptimistic
dbs.Source = "SELECT * FROM tblEmployees" & _
"WHERE EmployerName = '" & EmplName & "' and fieldauto = " & random & ""
Set dbs.ActiveConnection = mcnn
dbs.Open
If dbs.RecordCount > 0 Then
count = count + 1
'Display all your info here
End If
dbs.Close
mcnn.Close
'Commented out 11:53 >>Wend
Loop
End Sub
Private Sub Command2_Click()
Form4.Hide
Form3.Show
End Sub
Private Sub Form_Load()
'The following sections populate a ComboBox with results from an Access query
Dim Conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
With Conn
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\autochooser.mdb ;Persist Security Info=False"
.Open
End With
With cmd
Set .ActiveConnection = Conn
.CommandText = "qryEmployerNames" 'Name of the access query
.CommandType = adCmdStoredProc
'Add a parameter if needed
'.Parameters.Append .CreateParameter("Param", adInteger, adParamInput, 6)
'.Parameters("Param"

.Value = variable
End With
rs.Open cmd, , adOpenDynamic, adLockOptimistic
rs.MoveFirst
Do
Form4.Combo1.AddItem rs![EmployerName]
rs.MoveNext
Loop Until rs.EOF
End Sub