473,387 Members | 1,516 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,387 software developers and data experts.

Unable to edit form - Many-to-Many relationship

CC
Dear,

I have a form that is opened using a sql statement:

Part of the table structure:
-----------------------------------------
TbGeneral:
PK - dsr_id

TbDossierSample:
PK - dsr_sample_id
FK - sample_id
FK - dsr_id

TbCRL
PK - sample_id
----------------------------------------
On the form that is linked to TbGeneral, there is a button that opens
the form linked to TbCRL.
"Dossier" mentioned below is the primary key of TbGeneral (Me!dsr_id)

SQL = "SELECT * FROM TbCRL, TbDossierSample WHERE
(([TbCRL.sample_id]=[TbDossierSample].[sample_id]) AND
([TbDossierSample.dsr_id]=" & Dossier & "))"

Once the form (linked to TbCRL) is opened, records cannot be edited.

I've already read some threads about the issue, explaining the problem
is located at the table structure and saying editable fields are only
possible with a form linked to a single table.

Isn't there any alternative?
(I've tried "Allow.Edits" in VBA without success)
ANY help is most welcome...

Thanks in advance,

CC

Dec 21 '05 #1
5 2171
CC wrote:
Dear,

I have a form that is opened using a sql statement:

Part of the table structure:
-----------------------------------------
TbGeneral:
PK - dsr_id

TbDossierSample:
PK - dsr_sample_id
FK - sample_id
FK - dsr_id

TbCRL
PK - sample_id
----------------------------------------
On the form that is linked to TbGeneral, there is a button that opens
the form linked to TbCRL.
"Dossier" mentioned below is the primary key of TbGeneral (Me!dsr_id)

SQL = "SELECT * FROM TbCRL, TbDossierSample WHERE
(([TbCRL.sample_id]=[TbDossierSample].[sample_id]) AND
([TbDossierSample.dsr_id]=" & Dossier & "))"
Perhaps you could enter, just under the SQL line
Debug.Print SQL
Now go to the debug window, copy to clipboard the result, and try to
create a query with it. Does it work?

One reason I question your SQL is that you have
SELECT * FROM TbCRL, TbDossierSample
and I'd think you'd want
SELECT TbCRL.* , TbDossierSample.* ...

Also, verify that you don't have the recordsource type set to snapshot
in the form (under the Data tab for the Form's properties). But I tend
to think you SQL is flawed.


Once the form (linked to TbCRL) is opened, records cannot be edited.

I've already read some threads about the issue, explaining the problem
is located at the table structure and saying editable fields are only
possible with a form linked to a single table.

Isn't there any alternative?
(I've tried "Allow.Edits" in VBA without success)
ANY help is most welcome...

Thanks in advance,

CC

Dec 21 '05 #2

"CC" <se********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Dear,

I have a form that is opened using a sql statement:

Part of the table structure:
-----------------------------------------
TbGeneral:
PK - dsr_id

TbDossierSample:
PK - dsr_sample_id
FK - sample_id
FK - dsr_id

TbCRL
PK - sample_id
----------------------------------------
On the form that is linked to TbGeneral, there is a button that opens the form linked to TbCRL.
"Dossier" mentioned below is the primary key of TbGeneral (Me!dsr_id)


CC,

SELECT *
FROM TbCRL
,TbDossierSample
WHERE (([TbCRL.sample_id] = [TbDossierSample].[sample_id])
AND ([TbDossierSample.dsr_id] = " & Dossier & "))"

Ok, it appears you have a cartesian product, where each row of TbCRL
is joined to every row of TbDossierSample (rows * rows), (the WHERE
is only applied after that).

This is, as far as I know, a non-updateable query.

You must specify an SQL-92 standard join (INNER, RIGHT, LEFT) on
primary key values in order for the query to be updateable (in most
cases, anyway).
Sincerely,

Chris O.


Dec 21 '05 #3
one option might be to create the SQL statement in the query builder
and then open the query and then try to add a record to that... if it
won't, then try modifying from there.

Dec 22 '05 #4
CC
Dear Chris,

I haven't had the time yet to come back to the problem (because of
other priorities).
INNER, RIGHT and LEFT JOINS were new concepts to me.

Having read some of the literature, I can now see the problems related
to
a cartesian product.

For the moment I have tested following:

"SELECT TbDossierSample.sample_id, TbCRL.sample_id FROM TbDossierSample
INNER JOIN TbCRL ON TbCRL.sample_id = TbDossierSample.sample_id WHERE
TbDossierSample.dsr_id='" & dossier &"'"

dossier in the above statement is TbGeneral.dsr_id for the record that
is currently displayed.

However now I even get the desired output for the query... Is it
possible to combine multiple INNER JOIN's ?
Best regards,

Seppe

Jan 9 '06 #5
CC
Dear Chris, Dear all,
Executing following SQL statement as a "query object", returns the
desired results...
It also allows for new entries to be added.

SQL = "SELECT TbDossierSample.sample_id, TbDossierSample.dsr_id FROM
TbDossierSample INNER JOIN TbCRL ON TbDossierSample.sample_id =
TbCRL.sample_id WHERE TbDossierSample.dsr_id=" & Dossier & ""

(where "Dossier" is the primary key of TbGeneral, Dossier =
Form_FrmGeneral.Text142)

However, when retrieving the results fails when using lower mentioned
statement.
Forms![fm_CRL_Main].RecordSource = SQL

I've been struggeling with this for some time now!
Thx in advance,

Seppe

Jan 10 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carl Gilbert | last post by:
Hi I have recently been having trouble with the edit items in both the context menu and edit menu in vs.net designer. On the context menu, the only items that are not disabled are 'View code'...
2
by: Apple | last post by:
I had create a query with one table and one query, and then create form with that query using wizard, but I can't append or edit data in that form & query. Please help!
1
by: libbythomas | last post by:
I created an Access 2000 form from a query. But I cannot edit it. I can flip through the records. If I create a table from the query (maketable) and then create the form from the table, it is...
13
by: John M | last post by:
Hello, In Visual studio .NET 2003, On datagrid object : How can I link the button element : edit, to do a some client events (such as message box, and do another event just after that to the...
2
by: Aled Hughes | last post by:
Hi, I have an MFC application that has a CDialog based dialog box that contains a .net UserControl (via DDX_ManagedControl) as well as a native edit control which has the ES_NUMBER style set. Now...
4
by: scenic_man | last post by:
I'm using Microsoft Visual Basic 2005 Express Edition; is this the right newsgroup? I just started within the last two weeks, working my way through a book. Today, I opened the program, and my...
3
by: nuttynibbles | last post by:
im doing a edit profile page. the page would pull out data frm mysql and populate the forms respectively. user will edit and update their profile. The page would then validate the value in the...
1
by: shapper | last post by:
Hello, In have a web page layout with various panels. One panel contains a GridView and other panel contains various TextBox, DropDownList, etc. When I click a a GridView row I make visible...
1
by: Adam | last post by:
Hi All, I have a grid view which contains an edit button (ie: CommandName="Edit"). When clicked this button displays a form view with the required details displayed. Problem: When this...
4
by: barkarlo | last post by:
I use check box in a form "frmworkorder" like confirmation that's record finish. How can I write code who will block edit and delete record in form when is check box confirmed.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...

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.