pulling SQL records

Status
Not open for further replies.
J

Joel Allen

Outlook 2003 SP3

Hello,

I run select queries from within my code to populate certain fields from a

SQL database. I need to run a "For each" command and am not having luck.

This is what I have so far. For each record it finds, I want it to do

something. Am I going about this wrong?

Set EachRecord = Nothing

Set EachRecord = rst.Open "Select * FROM tblCO WHERE JobNumber = '" &

Item.UserProperties("JobNumber") & "'", _

oADOConn, adOpenKeyset, adCmdTable

For EachRecord

msgbox"hi"

Next

Thanks Joel
 
You might loop through an ADO recordset like this:

rst.movefirst

while not rst.eof

debug.print rst.fields("abc").value

rst.movenext

wend

See the ADO help file for details. This has nothign to do with Outlook.

Best regards

Michael Bauer

Am Fri, 28 Aug 2009 16:17:44 -0700 schrieb Joel Allen:


> Outlook 2003 SP3

> Hello,

> I run select queries from within my code to populate certain fields from a
> SQL database. I need to run a "For each" command and am not having luck.

> This is what I have so far. For each record it finds, I want it to do
> something. Am I going about this wrong?

> Set EachRecord = Nothing
> Set EachRecord = rst.Open "Select * FROM tblCO WHERE JobNumber = '" &
> Item.UserProperties("JobNumber") & "'", _
> oADOConn, adOpenKeyset, adCmdTable

> For EachRecord
> msgbox"hi"
> Next

> Thanks Joel
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
L Correct E-Mail Pulling Wrong Mail Using Outlook 5
C Pulling out my hair (O365/2016) Using Outlook 4
K Outlook admin vs individual access (VBA pulling info) Outlook VBA and Custom Forms 1
B Outlook Business Contact Manager with SQL to Excel, User Defined Fields in BCM don't sync in SQL. Can I use VBA code to copy 1 field to another? BCM (Business Contact Manager) 0
B Advanced Search in MS Outlook by VBA and SQL Outlook VBA and Custom Forms 2
Eduardo Macias BCM 2013 with SQL Express 2014 BCM (Business Contact Manager) 5
daveTQM Sync address book / contacts to SQL / Azure Exchange Server Administration 1
H SQL update column BCM (Business Contact Manager) 0
K BCM on SQL Server 2012? BCM (Business Contact Manager) 7
J Install BCM Client without an local SQl Database BCM (Business Contact Manager) 6
P Installation BCM impossible due to untraceable old SQL-server remains BCM (Business Contact Manager) 6
crazyboy SQL 2014 and BCM BCM (Business Contact Manager) 1
O x86 vs. x64 Sql Server 08 Dbase Questions BCM (Business Contact Manager) 2
T OL BCM 2007 - Possible to migrate SQL Server Express 2012 ? BCM (Business Contact Manager) 2
P BCM 2013, Microsoft SQL Server 2008 R2 (SP2), attachment issue n database size BCM (Business Contact Manager) 2
D What is this SQL filter that is applied to my Inbox? Using Outlook 6
M BCM in Outlook reports maximum database size to 4GB despite SQL Server 2008 R2 BCM (Business Contact Manager) 1
M "No database found" but successful connection to SQL server.What am I missing? BCM (Business Contact Manager) 5
B can not establish BCM 2010 connection to Shared DB on SQL 2008 Express BCM (Business Contact Manager) 4
C Remote BCM database 2010 hosted via Godday SQL Server + access via PC Window 7 BCM (Business Contact Manager) 3
B Reading CompressedRichText field in SQL database BCM (Business Contact Manager) 1
B How to create the customized Outlook SQL DASL for selected days? Outlook VBA and Custom Forms 2
M How to connect to SQL DB from outlook programmatically? Outlook VBA and Custom Forms 1
O transfer BCM SQL data without backup BCM (Business Contact Manager) 1
H Outlook 2007 SQL syntax to filter views of tasks and todo items Outlook VBA and Custom Forms 1
R SQL Server Setup failed - Please help?! BCM (Business Contact Manager) 2
M Outlook / BCM / SQL 2005 Express Windows 7 BCM (Business Contact Manager) 3
S BCM install fails at SQL install BCM (Business Contact Manager) 1
M Grab info from attachment and put into SQL db Outlook VBA and Custom Forms 1
J Moving BCM 2007 Database to a SQL 2005 Server BCM (Business Contact Manager) 2
E Display Outlook Data from more than one Folder like SQL JOIN Outlook VBA and Custom Forms 3
V Business Contact Manager 2007 and SQL Server 2008 BCM (Business Contact Manager) 3
V Connecting BCM 2007 to SQL Server 2007 BCM (Business Contact Manager) 1
N Can I install BCM client without SQL Express? BCM (Business Contact Manager) 1
E Re:BCM failed to install in outlook 2007 due to SQL Server Express 20 BCM (Business Contact Manager) 1
C Cannot seem to use BCM Database Tool on SQL Server 2008 BCM (Business Contact Manager) 4
S will SQL 2003 work for remote server BCM (Business Contact Manager) 1
D 2003 Outlook with BCM SQL server failure BCM (Business Contact Manager) 1
J BCM Database and SQL Server Issues? BCM (Business Contact Manager) 7
D 1 user account not working - SQL Permissions BCM (Business Contact Manager) 1
D Outlook 2007 BCM SQL server problem BCM (Business Contact Manager) 1
J Microsoft SQL control within custom form Outlook VBA and Custom Forms 1
M MSO OL sp2 for BCM broke SQL Database connection BCM (Business Contact Manager) 2
D Installing SQL Server 2008 Express with BCM installed BCM (Business Contact Manager) 3
K Auto-linking emails by default shared DB BCM 2007 on SQL 2008 BCM (Business Contact Manager) 4
D Install SQL on a remote server for 2003? BCM (Business Contact Manager) 1
V Unable to Install Microsoft SQL Server 2005 express BCM (Business Contact Manager) 2
T Uploading Outlook 2016 Contacts to Exchange Server Drops "Company" field data in 30% of records Exchange Server Administration 4
M What is the best way to find all records of an e-mail for our company? Outlook VBA and Custom Forms 2
M Customize Comments / Notes Section time stamp on Contact Records BCM (Business Contact Manager) 0

Similar threads

Back
Top