I have a situation where I'm trying to add a text field to allow
large Notes to be linked to record in an existing table (rather than
simply adding the new field into the table since relatively few
records will have the Note)
Tables are basically:
T1
ID InvNumFK
----------------------
40 | 1
42 | 2
43 | 2
44 | 1
T2
MatDetId EqpNote
-------------------------------------------------
40 | text
44 | additional Note
I'm trying to create a subform that will allow the user to view/update
records in T1 (there are other fields in T1 that aren't relevant to
the problem) and also add a record into the T2.EqpNote field or edit a
record that already exists.
This query works in Access (allows me to type in text into the EqpNote
field and automatically create a new record in T2 with the T1.Id value
in the T2.MatDetId field) :
SELECT T1.ID, T1.InvNumFK, T2.EqpNote, T2.MatDetId
FROM T1 LEFT JOIN T2 ON T1.ID = T2.MatDetId
WHERE (((T1.ID)=10230 ));
but when I try to 'translate' it into a version that I can use for the
subform in the adp (it's an Access 2000 project with a SQL Server 2000
backend) the 'child' record does not get added into T2.
Here's the record source I'm using for the form in the adp
SELECT T1.ID, T1. InvNumFK, T2.MatDetId, T2.EqpNote FROM T1 LEFT
OUTER JOIN dbo.T2
ON T1.ID =T2.MatDetId
WHERE T1.InvNumFk = XX
--'master' table
CREATE TABLE [dbo].[T1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[InvNumFK] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tblBSMaterialDe t] WITH NOCHECK ADD
CONSTRAINT [PK_T1] PRIMARY KEY NONCLUSTERED
(
[ID]
) ON [PRIMARY]
GO
--Sub table
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[T2]') and OBJECTPROPERTY( id, N'IsUserTable') = 1)
drop table [dbo].[T2]
GO
CREATE TABLE [dbo].[T2] (
[MatDetId] [int] NOT NULL ,
[EqpNote] [text] COLLATE SQL_Latin1_Gene ral_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[T2] WITH NOCHECK ADD
CONSTRAINT [PK_T2] PRIMARY KEY CLUSTERED
(
[MatDetId]
) ON [PRIMARY] 1 1378
(ck****@mindspr ing.com) writes: This query works in Access (allows me to type in text into the EqpNote field and automatically create a new record in T2 with the T1.Id value in the T2.MatDetId field) : SELECT T1.ID, T1.InvNumFK, T2.EqpNote, T2.MatDetId FROM T1 LEFT JOIN T2 ON T1.ID = T2.MatDetId WHERE (((T1.ID)=10230 ));
but when I try to 'translate' it into a version that I can use for the subform in the adp (it's an Access 2000 project with a SQL Server 2000 backend) the 'child' record does not get added into T2.
Here's the record source I'm using for the form in the adp SELECT T1.ID, T1. InvNumFK, T2.MatDetId, T2.EqpNote FROM T1 LEFT OUTER JOIN dbo.T2 ON T1.ID =T2.MatDetId WHERE T1.InvNumFk = XX
This sounds like mumbo-jumbo to me. You have a SELECT query, and from
that you are trying to update a table? What about using INSERT
statements?
Since I don't know Access or ADP, I cannot be of much help. But I
have never liked client API that constructs code behind your back.
Sooner or later, they will outsmart you.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Quarco |
last post by:
Hey,
Suppose you have a table_ex like:
id nuber1 chr ( = a or b)
1 1000 a
2 1001 a
3 1002 b
4 1003 a
etc..
|
by: jbm05 |
last post by:
Hi,
I'm curious about the computational complexity of a query I have. The
query contains multiple nested self left joins, starting with a simple
select, then doing a self left join with the results, then doing a self
left join with those results, etc. What puzzles me is that the time
required for the query seems to grow exponentially as I add additional
left joins, which I didn't expect. I expected the inner select to
return about 25...
|
by: Steve |
last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three
"Left Outer Joins" in order to return every transaction for a specific
set of criteria.
Using three "Left Outer Joins" slows the system down considerably.
I've tried creating a temp db, but I can't figure out how to execute
two select commands. (It throws the exception "The column prefix
'tempdb' does not match with a table name or alias name used in the
query.")
|
by: Steve |
last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three
"Left Outer Joins" in order to return every transaction for a specific
set of criteria.
Using three "Left Outer Joins" slows the system down considerably.
I've tried creating a temp db, but I can't figure out how to execute
two select commands. (It throws the exception "The column prefix
'tempdb' does not match with a table name or alias name used in the
query.")
|
by: Scott Marquardt |
last post by:
My SQL acumen stems from just a couple courses, and everything since from
the trenches. Fun + angst over time.
I'm needing some advice on joins. Though I understand the basics, I'm
having problems abstracting from instances where it's easy to think about
discrete key values (. . . and studentid = 1234) to entire sets of users,
with the joins doing their work.
For example, currently I'm going nuts trying to return dates for which...
| |
by: Ian Boyd |
last post by:
i know nothing about DB2, but i'm sure this must be possible.
i'm trying to get a client to create a view (which it turns out is called a
"Logical" in DB2). The query needs a LEFT OUTER JOIN, but he doesn't know
how to do that, or even if he can, and i don't have to time to learn DB2
from scratch right now.
The following SQL Query is a trimmed sample of the full View (i.e. Logical)
definition - and i would create it on an SQL based...
|
by: Alan Lane |
last post by:
Hello world:
Background:
Yesterday, January 21, Doug Steele was kind enough to help me out on a Left
Join problem. I was trying to return all stores and their Gross Adds for
December, 2004 (even though some of them had no Gross Adds for that month).
My query would only show the non-zero GA stores. Doug stated "It's because
of the Where clause. The stores which don't have any records for the period
in question are being eliminated...
|
by: ckirby |
last post by:
I have a situation where I'm trying to add a text field to allow
large Notes to be linked to record in an existing table (rather than
simply adding the new field into the table since relatively few
records will have the Note)
Tables are basically:
T1
ID InvNumFK
----------------------
|
by: shapper |
last post by:
Hello,
I am used to SQL but I am starting to use LINQ.
How can I create Left, Right and Inner joins in LINQ? How to
distinguish the different joins?
Here is a great SQL example:
http://www.codinghorror.com/blog/archives/000976.html
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |