473,785 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Edit s" in VBA without success)
ANY help is most welcome...

Thanks in advance,

CC

Dec 21 '05 #1
5 2191
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.Edit s" in VBA without success)
ANY help is most welcome...

Thanks in advance,

CC

Dec 21 '05 #2

"CC" <se********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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
,TbDossierSampl e
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_i d 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
1052
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' and 'Change name and text properties'. On the edit drop down only the 'Find and replace' menu item is enabled. This sometimes resolves itself when I close the form and re-open or close VS
2
2712
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
10088
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 editable. But that is not the way I want it. Any suggestions?
13
1423
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 server (do some manipulation on the database).
2
4553
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 a very strange thing happens: If I press a non-numeric key in the native edit control, up pops a little balloon tip saying "Unacceptable Character", however when I press the key again, the tooltip disappears, reappears and in the process blanks...
4
1050
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 three recent projects were listed. However, when I open any one of them, I can find all sorts of .vb (code) files and resources of various kinds, but no representation of the form that I can edit! If I click F5, the applications runs and...
3
1820
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 form. if there's an error, it would prompt the user. when this happen, the form do not retain the newly entered value but instead re-display what is pull out from the database.. how do i retain the newly entered value in the textbox? here is my code:...
1
3396
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 the Form Panel so that the user can edit the data. My questions are:
1
1421
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 buttons is clicked it is sending the Grid View into edit mode, thus displaying unwanted text boxes etc in the Grid.
4
4413
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
9643
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, 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...
0
9480
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,...
0
10319
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, 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...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7496
isladogs
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...
0
6737
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();...
1
4046
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.