473,624 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updateable recordset, please?

I've recently migrated the back end of one of my client's applications
from Access to SQL Server.

One of the forms is based on an Access query thus:

SELECT dbo_tblDistribu tionDetail.*,
dbo_tblDistribu tionMaster.fldD ocumentType,
dbo_tblDistribu tionMaster.fldD ocumentID, dbo_tblDistribu tionMaster.ts
FROM dbo_tblDistribu tionMaster INNER JOIN dbo_tblDistribu tionDetail ON
dbo_tblDistribu tionMaster.fldD istributionID =
dbo_tblDistribu tionDetail.fldD istributionID
WHERE (((dbo_tblDistr ibutionDetail.f ldCurrent)=True ));
At run time, the form's Form_Load event contains the following code:

Me.RecordSource = "SELECT * FROM qryDistribution WHERE (" &
Me.OpenArgs & ");"

Thus, typically, the ACTUAL RecordSource might be:

SELECT *
FROM qryDistribution
WHERE (dbo_tblDistrib utionDetail.fld DistributionID = 4072);

Under Access, I could make changes on the form and press the form's
Save button, whose code behind contained the line:

DoCmd.RunComman d acCmdSaveRecord

Now, under SQL Server, when I try to make a change on the form the
status bar shows

"This recordset is not updateable"

and if I press the "Save" button I get error number 2046 "The command
or action 'SaveRecord' isn't available now."

I have added Timestamp fields to both SQL Server tables referenced in
the query, and these are included in the query itself.

One obvious way around this would be to unbind the form, populate the
form's controls explicitly, and then save the data to the correct
tables using SPROCs or in-line SQL. However, if there is an easier
way, I'd like to know it.

Many thanks in advance

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
Nov 13 '05 #1
1 2468
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For each table to be updateable the front-end must be able to "see" a
unique value column(s) in the table (usually the Primary Key or a
TimeStamp column). You do not need to include that column in your
queries. Try unlinking your SQL tables and re-linking them. When
Access cannot recognize the unique column in the SQL table it will
prompt you for that column(s) in a pop-up dialog box w/ a list of
columns. If you see this prompt you'll know there isn't a Primary Key
or unique TimeStamp column in that table, and, therefore, you need to
create that uniqueness. Or, in the prompt, you can indicate the
column(s) you believe will always hold unique values.

Queries that use more than one table, and update values in those tables,
must have all the unique columns and required columns for all tables in
the query SELECT list.

Since you're using Access/JET query syntax try using the DISTINCTROW
keyword in the SELECT clause:

SELECT DISTINCTROW col1, col2, col3, ... etc. ...

This sometimes makes queries updateable.

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQVHE+4echKq OuFEgEQLJ8gCgvS sa0olghyp9RcRQj nIrvNIrUlkAn058
GGu0iRknhF/FS1DSN3lq2Yao
=MEDk
-----END PGP SIGNATURE-----
Edward wrote:
I've recently migrated the back end of one of my client's applications
from Access to SQL Server.

One of the forms is based on an Access query thus:

SELECT dbo_tblDistribu tionDetail.*,
dbo_tblDistribu tionMaster.fldD ocumentType,
dbo_tblDistribu tionMaster.fldD ocumentID, dbo_tblDistribu tionMaster.ts
FROM dbo_tblDistribu tionMaster INNER JOIN dbo_tblDistribu tionDetail ON
dbo_tblDistribu tionMaster.fldD istributionID =
dbo_tblDistribu tionDetail.fldD istributionID
WHERE (((dbo_tblDistr ibutionDetail.f ldCurrent)=True ));
At run time, the form's Form_Load event contains the following code:

Me.RecordSource = "SELECT * FROM qryDistribution WHERE (" &
Me.OpenArgs & ");"

Thus, typically, the ACTUAL RecordSource might be:

SELECT *
FROM qryDistribution
WHERE (dbo_tblDistrib utionDetail.fld DistributionID = 4072);

Under Access, I could make changes on the form and press the form's
Save button, whose code behind contained the line:

DoCmd.RunComman d acCmdSaveRecord

Now, under SQL Server, when I try to make a change on the form the
status bar shows

"This recordset is not updateable"

and if I press the "Save" button I get error number 2046 "The command
or action 'SaveRecord' isn't available now."

I have added Timestamp fields to both SQL Server tables referenced in
the query, and these are included in the query itself.

One obvious way around this would be to unbind the form, populate the
form's controls explicitly, and then save the data to the correct
tables using SPROCs or in-line SQL. However, if there is an easier
way, I'd like to know it.


Nov 13 '05 #2

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

Similar topics

7
8731
by: ren | last post by:
Hello, When I open with Access 2000 a .DBF table and try to modify the content of a (random) record, I get the message 'This recordset is not updateable". And indeed, I can't change the content nor delete it. However, when opening the same .DBF tabel with Access 2000, though installed on another computer, I can change the content or delete the record. Obviously this Access has other setting(s), but which??? Can anyone help me out?
3
17509
by: jm | last post by:
I have a simple query. It has two tables. If I open the tables separately, I can add records. If I open them up together, the recordset is not updateable. As best I know, this has never been a problem it just happened all of a sudden. - The database has been repaired and converted several times to no avail. - All the permissions are correct. - Copying and pasting the table and query in the same database does
4
5527
by: MNC | last post by:
I'm using Access2002, and can't seem to get an updateable recordset going :-( What am I doing wrong, here's the code. The form's controls are not locked, the recordset type is Dynaset (changing to Dynaset inconsistent updates does not work), I'm allowing edits, and I'm at a loss ... Please help! Option Compare Database
5
1993
by: Marie | last post by:
Access97 I have a table containing addresses with a separate field for State. Is there a way to create a query that returns an unique list of the states in that table and still be updateable? I tried setting the unique values property to Yes but that gave me a recordset that was not updateable. Thanks! Marie
2
5188
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I want the recordset (rs) in the following function to be updateable. How do I do it? Even though the code is VBA I will be translating to VBS for a MS SQL Server DTS package. That I know how to do. I just don't know how to open the Connection and/or Recordset so I can change the SQL WHERE clause in the loop & then update the resulting recordset.
3
1720
by: dd_bdlm | last post by:
Please help this one is driving me mad! I have searched and read all the topics on the error message I am receiving but none seem to apply to me! I have quite a complex query linking all parts of my database together doing final calculations etc. This query when run (through the form) comes up with 'this recordset is not updateable' error. I can run the query on its own but it wont accept new records (and indeed doesnt have a blank...
11
1794
by: pugalenthi | last post by:
I have a database with many tables, queries and forms. The problem actually lies in one of the tables. This table has a field for which i had set previously as indexed and duplicates ok. But now when i change this property to no duplicates then my form becomes not updateable. Actually a query is based on this table and the form in turn in based on this query. Please help me solve this problem.
1
2124
by: sureshkmsc | last post by:
Hello Sir/ Madam i am suresh today i am joined this community. please help me. i have installed WindowsXp, Internet Information Services 5.1 (IIS) this IIS and Microsoft Access 2003 installed. olny read the database value but not insert and update the value in database. what is the problem?.i don't know. please help me. set con=server.CreateObject("adodb.connection") set rs=server.CreateObject("adodb.recordset") con.open...
7
5633
by: tnjarrett | last post by:
Hello, I have a MS Access continuous subform that was using a query as the recordsource. I changed it to use a recordset instead because when the query was used, the changes to the subform values directly changed the tables under the query. I wanted the changes to be 'in-memory' so that I could check them before applying them to the tables. When I changed the subform to use the recordset, it is now 'read-only' and I can't change anything...
0
8619
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
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7158
agi2029
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...
1
6108
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
5561
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();...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2604
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
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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.