I suggest adding a field in your table to mark the customer as already contacted or not. Can just make it a yes/no field, and then select only those customers not already contacted. What I am putting as code is only to get the records loaded in your recordset, and assigns some values from table to variables. It would also mark the customer as contacted.
Hard to be exact as I don't know what database fields you have, what the table name is/are, etc. but basically:
Private Sub CommandButtonGETNEXT_Click()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sql, CustomerName, CustomerNumber as string
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=U:\CallCentre\Sales\Agents\Outbound\CustomerDatabase.accdb"
Set rst as New ADODB.Recordset
Set Rset1.ActiveConnection = dbs
sql = "SELECT * FROM yourtablenamehere WHERE Contacted = False" 'to only obtain not-contacted records
rst.open sql, cnn, adOpenStatic, adLockOptimistic
If rst.recordcount > 1 then
with rst
.MoveFirst 'moves to first record in the list of not-contacted customers
CustomerName = ![cust_name] 'variable CustomerName getting the value of cust_name in database (replace with your names)
CustomerNumber= ![cust_number] 'variable CustomerNumber getting the value of cust_number in database (replace with your names)
![contacted] = "True" 'marks customer as already contacted. Do you want this later with confirmation contact was made?
.Update
End With
End If
Set rst = nothing
Set cnn = nothing
End Sub
Bookmarks