Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 7th, 2004, 12:33 AM
Registered User
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Shape My Command-Please

Here's the plan. I have 2 tables not related except for a jobid field. I set up a temp table and run a sql statment on each table to insert records into the temp table from the original tables. Works great. Then I run sql statements on the temp table to create a command. See code below. Each command in iteself runs fine, but I need to join the 2 commands together inorder to run a report. For some reason I get a syntax error when I join the commands with append the cmd and pcmd together. The only thing I am trying to accomplish is to run a report like:

id qty
2412 20
2414 30
2416 40

plid plqty
321 10
215 15
336 30




strSQL = "Select jobid,id, sum(qty) as SumOfQty from " & ausername & "report Group By jobid,id"

pstrSQL = "Select jobid, plid, sum(plqty) as plSumOfQty from " & ausername & "report Group By jobid, plid"

With cmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = "SHAPE {" & strSQL & "} As cmdGroup1 Compute cmdGroup1 BY 'id'"
.Execute
End With

With pcmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = " SHAPE {" & pstrSQL & " } As pcmdGroup2 Compute pcmdGroup2 BY 'plid'"
.Execute
End With








Similar Threads
Thread Thread Starter Forum Replies Last Post
writing a shape to a file ironchef Java Basics 0 November 8th, 2006 06:35 PM
ado shape syntax sunpalozzi SQL Language 0 November 2nd, 2006 04:43 PM
Delete object shape name stepdev Excel VBA 0 May 3rd, 2006 11:57 AM
Rotating shape in VBA (not center of shape) Piblon Excel VBA 3 April 13th, 2006 04:04 AM
"No Fill" for Shape Objects msvedlow Excel VBA 2 September 5th, 2003 10:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.