View Single Post
 
Old 05-10-2021, 10:18 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

We are not able to do much to help you as we don't have access to your database, nor to the procedure named "usp_WordMerge_SelAddlinesByFileNumber" which I assume is in the database.

I've used a SQL string to create the filtered recordset and then traversed that subset of data with the processing. This page shows the basic method
Using Excel VBA to Query a SQL Server Database | PTR

You will need to know the table (or query) name where the CustomerID field exists
Dim lngID as Long
lngID = 0947000 'assuming it is stored as a number
Set rs = conn.Execute("SELECT * FROM TableName WHERE CustomerID = " & lngID)

If your recordset is already filtered to a unique CustomerID then there won't be a need to test the values of that field since you already know what it is.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote