Solved

sql ...

Posted on 1998-08-05
5
169 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
  • 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 100 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now