Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql ...

Posted on 1998-08-05
5
Medium Priority
?
177 Views
Last Modified: 2010-05-03
Dim db As Database
Dim szsql As String
Dim objXL As Object
Dim numcopies As Integer

Set db = OpenDatabase("c:\stock.mdb")
       
           
szsql = "select into nice_rpt " _
        & "in 'c:\excel\nice_rpt.xls' 'EXCEL 5.0;' Description.StockCardNo as 'stockcode', Description as 'Description', Product.Specifications as 'Specifications', Product.ProductID as 'ProductID' from Description, Product where " _
        + "Description.StockCardNo = Product.StockCardNo"

MsgBox szsql
db.Execute szsql
numcopies = 1

Set objXL = CreateObject("excel.application")
objXL.workbooks.Open "c:\excel\path\nice_rpt.xls"
objXL.activeworkbook.activesheet.printout , , numcopies 'variable you define
objXL.activeworkbook.Close
Set objXL = Nothing

i got an error in the sql.. what's wrong?
0
Comment
Question by:brohans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:MorFF
ID: 1468069
You've got a + instead of an &   

"      + "Description.StockCardNo = Product.StockCardNo"      "

MorFF
0
 

Author Comment

by:brohans
ID: 1468070
it did not work :(
0
 

Author Comment

by:brohans
ID: 1468071
Adjusted points to 100
0
 

Accepted Solution

by:
stefie earned 200 total points
ID: 1468072
Maybe you can change Description as 'Description' in :
Description.Description as 'Description'
0
 
LVL 3

Expert Comment

by:MorFF
ID: 1468073
What does the error say?
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question