Adding SQL Select Statement

P

Pepe

Hello. I set up a connection to a SQL view using VBA. I'm pulling
back many fields including a 'work notes' field. The problem is the
notes, and any field after the notes field in the select statement are
all coming back blank. I'm wondering if the field is too long, and if
it is very long then can I enter any code to work around this or to
indicate that it IS long and to bring it over anyway.

Strangely enough, when I link to the same view in Access and then link
Excel to Access I get the data. I was hoping to remove the middleman
however and just go directly to the SQL view using VBA in Excel
though.

Not sure if it will help, but here is the select statement.

"SELECT [Date Lead Sent], [Lead Date], Month, individualid,
incidentid, Company, [First Name], [Last Name], Address, " & _
"City, State, Zip, Country, Phone, Email, [Campaign Code], Promotion,
[Rep Name], [Lead Type], [Product Area], " & _
"[Number of Employees], [Work Notes], Region, Area, AccountInfo " & _

The [Work Notes] field is the one that is coming back blank, as well
as the Region, Area, and AccountInfo fields.

Any thoughts on this?

Thank you

Paul
 
R

Robin Hammond

There doesn't appear to be anything wrong with your select statement, but
here's an alternative idea.

In your sql server, create a view "NewView" that gives you all the
information you want, and none of the information you don't. i.e. leave out
the fields you don't need.

Then use Select * from NewView

It's probably a lot quicker than trying to solve your problem.

Robin Hammond
www.enhanceddatasystems.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top