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

DAO Recordsets

102 64KB
Background:
Front end: MS Access 2013
Back end: SQL Server 2008

I have a program that does the following:
Expand|Select|Wrap|Line Numbers
  1.  ' open Work_Downtime query
  2.      Dim rsQ As DAO.Recordset
  3.      Dim dbQ As Database
  4.      Set dbQ = CurrentDb
  5.      Set rsQ = dbQ.OpenRecordset("Q_dbo_tblDowntime", dbOpenDynaset, dbSeeChanges)
  6.  
  7.      ' are their records to delete?
  8.      If rsQ.RecordCount = 0 Then GoTo noQRecords
  9.  
  10.      Dim downtime As Integer
  11.  
  12.      ' position to read
  13.      rsQ.MoveFirst
  14.  
  15.      While Not rsQ.EOF
  16.  
  17.            If rsQ.Fields("FixReject") = "0" Then
  18.               downtime = DateDiff("n", rsQ.Fields("Start_Datetime"), rsQ.Fields("End_DateTime"))
  19.            End If
  20.  
  21.  
  22.            rsQ.Edit
  23.              rsQ.Fields("DT") = downtime
  24.            rsQ.Update
  25.  
  26.            rsQ.MoveNext
  27.      Wend
I get the following error when I run the program. What is wrong?

Error#: 3164 Field cannot be updated
Aug 26 '15 #1
5 1171
Seth Schrock
2,965 Expert 2GB
Is Q_dbo_tblDowntime linked to a table or view in SQL Server? Do you have Write permissions to it?
Aug 26 '15 #2
sc5502
102 64KB
it is a query linked to a table on SQL Server
Aug 26 '15 #3
Rabbit
12,516 Expert Mod 8TB
Your query is probably written in a way where it's not editable.
Aug 26 '15 #4
Seth Schrock
2,965 Expert 2GB
Good point Rabbit.

@sc5502 Please post your query SQL (using code tags). Also, is the query in Access or on the SQL Server?
Aug 26 '15 #5
jforbes
1,107 Expert 1GB
You might be able to simplify this considerably if you were to write/create an Update Query against the Base Table.
Aug 26 '15 #6

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

Similar topics

4
by: Marco Alting | last post by:
Is it possible to INNER JOIN two recordsets in ASP? I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
6
by: Steve Jorgensen | last post by:
I keep having problems in which ADO disconnected recordset work under some circumstances, but lose all their data at other times, having no rows or fields, though the recordset object still exists....
2
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset...
1
by: lakshmi | last post by:
Hi all, I recently rewrote a data intensive C++ program in C#. The C++ program was traversing 3 recordsets that were all open at the same time. I replaced those 3 recordsets with 3 .NET data...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
4
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I...
4
by: rdemyan via AccessMonster.com | last post by:
Can someone help me with creating code that will look for DAO recordsets in modules and then check to see if the recordset is also closed in the module. All of my recordsets are of the form rs*...
11
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro...
21
by: neelsfer | last post by:
Ok i am back with a question about recordsets. I can add a record to two different recordsets at the sametime.(RacetimingT and RaceEntry5) My problem: how do i add a sequential number to both...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.