Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / November 2006



Tip: Looking for answers? Try searching our database.

crosstab, ADO and VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nmxnmx - 24 Nov 2006 22:41 GMT
Hi, well I'm using VB and Access as the db. I have made a crosstab
query in Access and it's work well, but when I do the same in VB
through ADO (not the control) it doesn't work.

I've just copied the SQL sentence as appear in Access to VB as
something like:

dim rs as ADODB.Recordset

str_sql = "crosstab query" ' this is the SQL sentence as appear in
Access

' conn is a ADODB.Connection already set
Call rs.Open(str_sql, conn, adOpenStatic, adLockOptimistic)
' I've tried with adOpenDynamic too, but I haven't gotten the correct
result

When I run that, the result is not that in Access is, the result with
ADO and VB give me only 3 fields -columns- (in Access are about 120
fields), I mean VB and ADO just show me the fields that in Access are
labeled as "row header" (well I don't know if this label is right
because I have the spanish version of Access and I don't know if this
is traslated this way in the english version), and those fields that
are showed by VB are completely empty.

Can not ADO handle crosstab queries? or what am I doing wrong?

Thanks in advanced
Michael B. Johnson - 27 Nov 2006 19:29 GMT
>Hi, well I'm using VB and Access as the db. I have made a crosstab
>query in Access and it's work well, but when I do the same in VB
>through ADO (not the control) it doesn't work.

<snipped/>

>When I run that, the result is not that in Access is, the result with
>ADO and VB give me only 3 fields -columns- (in Access are about 120
[quoted text clipped - 5 lines]
>
>Can not ADO handle crosstab queries? or what am I doing wrong?

AFAIK, ADO will not run MS Access PIVOT queries using only the name of the MS
Access queries. You'll need to view the query as SQL, copy that into a VB
string, then use than in your call to "rs.Open".

If you don't want to copy the PIVOT text and run the query using its SQL
equivalent, then you may want to use DAO.
_______________________
Michael B. Johnson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.