Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2021, 10:18 PM
Guessed's Avatar
Guessed Guessed is offline VBA script to pull data into existing document Windows 10 VBA script to pull data into existing document Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA script to pull data into existing document Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles stanley Word 4 12-15-2020 10:59 AM
VBA script to pull data into existing document I cant get my Sum(Offset formula to pull appropriate data. Erickd90 Excel 7 07-28-2016 12:20 PM
VBA script to pull data into existing document pull data using drop down menu nfsmith Excel 8 03-23-2016 11:28 PM
Excel VBA: Pull data from web tinfanide Excel Programming 0 12-09-2011 02:11 AM
VBA script to pull data into existing document macro to pull data from multiple files psrs0810 Excel 2 10-25-2010 01:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft