Wrox Programmer Forums
|
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP 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 April 5th, 2004, 06:38 PM
Authorized User
 
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exporting an Access Query

Hello,

I have created a database for a directory I am creating for a new e-commerce site. I have several tables and I ran a query in access 2003. I was trying to export this to our SQL Database on our website. I am not even sure this is possible. I have no problem exporting normal tables, but when I export queries I get the following error:


ODBC – Call Failed

[Microsoft][ODBC SQL Server Driver][SQL Server]Multiple Identity Columns Specified for table ‘tbl_Category_Query’. Only one identity column per table is allowed. (#2744)

Does anyone have any idea how I can export a query in Access 2003 to MS SQL? I need this query because I am trying to use ASP to run a stored procedure, where I have combined some of the tables needed to for my directory.

I am using the following ASP Code to call this stored procedure:

Set objComm = Server.CreateObject("ADODB.Command")

objComm.ActiveConnection = strConnect
objComm.CommandText = "tbl_Category_Query1"
objComm.CommandType = adCmdStoredProc

Set objRS= objComm.Execute
Set objComm = Nothing

I get the following message when this code is run:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'tbl_Category_Query1'.
/Directory/TMP9l2l2vq22x.asp, line 34

I am assuming I receive this error message because I have not yet exported my query.
I appreciate your help.
 
Old April 12th, 2004, 06:32 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Default

With your Query open in Access design mode, click the SQL view button on the toolbar. Copy the SQL text to clipboard.

Then open your SQL server using an Access Project file. (Lookup in Access Help) Select "Views" from the navigation bar. Click New|Stored Procedure. Again click the SQL view and paste your SQL text into the SQL window. Click out of the SQL view window and watch as Access builds the stored procedure before you eyes.

Make further changes as needed such as setting any default values and formats for you fields. (i.e. replacing Now() with getdate(), etc.)

I have tried several methods, including the Access Upsizing Wizard. The method outlined above seems to work best.

 
Old May 16th, 2004, 03:18 PM
Authorized User
 
Join Date: Jan 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your help,

I have used this method several times and it works almost all the time. I came across a problem while using a criteria in the design wizard. I am more or less trying to run a filter for two different parameters. I am not sure how to do this with a recordset, I can only use one filter at a time: RS.Filter = "Company_ID = '50772'". So I created a stored procedure using the following statement:

  strSQL = "SELECT tbl_Comments_Complaints.Comment_ID, tbl_Comments_Complaints.Company_ID, tbl_Comments_Complaints.Company_Name, tbl_Comments_Complaints.Customer_Comments, tbl_Comments_Complaints.Customer_Rating, tbl_Comments_Complaints.Complaint, tbl_Comments_Complaints.Resolved, tbl_Comments_Complaints.Complaint_Resolution, tbl_Comments_Complaints.Complaint_Filed, tbl_Comments_Complaints.Complaint_Resolved, tbl_Comments_Complaints.Status, tbl_Comments_Complaints.Positive, tbl_Comments_Complaints.Negative, tbl_Comments_Complaints.email, tbl_Comments_Complaints.First_Name_Comp, tbl_Comments_Complaints.Last_Name_Comp, tbl_Comments_Complaints.Approved " & _
    "FROM tbl_Comments_Complaints " &_
    "WHERE (((tbl_Comments_Complaints.Approved)=True)) " & _
    "ORDER BY tbl_Comments_Complaints.Comment_ID; "

However, I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'True'.

/directory/complaint_view.asp, line 43


I am not sure why the criteria, i.e. the record must be equal to true, generates the above error. It seems to work fine in Access 2000 and 2003.

Any help would be welcomed!


 
Old June 18th, 2006, 07:05 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Simply change the condition to
WHERE ... <YourBooleanField>=1 (in case of TRUE)

In case of FALSE use =0

Robert
www.military.cz







Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Query Data From Access to Excel JimInSouthernCal Access VBA 3 December 21st, 2007 08:34 AM
Chapter 16: Exporting query data to Excel 5tr0ud BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 October 9th, 2007 04:23 PM
Exporting an Query anukagni Access 1 June 9th, 2006 06:21 AM
Run query & Exporting the Data to Excle anukagni Access 2 January 21st, 2006 04:49 AM
Exporting Query Results to Excel File redrobot5050 Access VBA 2 October 7th, 2004 05:26 PM





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