473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WhereClause problem using SQL Server

I just upsized my Access mdb to a SQL server backend. Now I'm working on the access ADP project to make it work right, so here is the problem.

I have a tabel of Customers open with their orders listed in a subform. I use a command button to open an order in a detailed view. the command is below
******************
Private Sub OrdersNew_Click()
On Error GoTo Err_OrdersNew_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"

stLinkCriteria = "Orders.[CustomerID]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_OrdersNew_Click:
Exit Sub

Err_OrdersNew_Click:
MsgBox Err.Description
Resume Exit_OrdersNew_Click

End Sub
********************
The Orders Form has the following SQL

SELECT dbo.Orders.*, dbo.Customers.Pricing
FROM dbo.Orders INNER JOIN
dbo.Customers ON dbo.Orders.CustomerID = dbo.Customers.CustomerID
*************************

The Problem:
I click on the command button and get the following error:
'The columb prefix 'Orders' does not match with a table name or alias name used in query.'

?????? Any ideas???????
Oct 20 '06 #1
1 1101
MMcCarthy
14,534 Expert Mod 8TB
Try this code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub OrdersNew_Click()
  3. On Error GoTo Err_OrdersNew_Click
  4.  
  5. Dim stDocName As String
  6. Dim stLinkCriteria As String
  7.  
  8. stDocName = "Orders"
  9.  
  10. stLinkCriteria = "[CustomerID]=" & Me.[CustomerID]
  11. DoCmd.OpenForm stDocName, , , stLinkCriteria
  12.  
  13. Exit_OrdersNew_Click:
  14. Exit Sub
  15.  
  16. Err_OrdersNew_Click:
  17. MsgBox Err.Description
  18. Resume Exit_OrdersNew_Click
  19.  
  20. End Sub
  21.  
  22.  
Oct 20 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Yves Touze | last post by:
Hi All, I'm trying to migrate from SQL Server 7.0 to SQL Server 2000. I've got some ASP page which call VB components that retrieve shaped recordsets from SQL Server using the MSDATASHAPE...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
1
by: Mike | last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta; frameworkv2.0.50215 ) the source code below I get errors (listed below due to the use of ICallBackEventHandler. Ultimately I...
1
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
5
by: Mukesh | last post by:
Hi i want to use AJAX.net in my Existing Application I have already installed the ajax .net ..net 3.0 and using VS 2005 in the old application i have added a new web form then script manager...
0
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation...
8
by: =?Utf-8?B?Q2hyaXMgSGFsY3Jvdw==?= | last post by:
Hi there I've successfully added some .NET validation controls to a page (using <asp:RequiredFieldValidator ...), however when I try to set the 'display' property to 'dynamic', my page then...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.