473,320 Members | 2,104 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.

Can't update a RecordSet

I have basically the same problem... (and I'm a Newbie). I have a sub-form that is being filtered based on the combo boxes available. The underlying query is straight forward for most selections... meaning the fileds are contained in a single table; no issues there. In one combination, the key field, status, is in a "related" table and a join is required. When that happens, the Project data is not editable.

MyCode when "only Active" is selected:
Expand|Select|Wrap|Line Numbers
  1. Me.RecordSource = "SELECT Projects.* FROM _
  2. (Projects INNER JOIN LastStatusDates ON _
  3. Projects.ProjectID = LastStatusDates.ProjectID)INNER JOIN StatusReports _ 
  4. ON (Projects.ProjectID = StatusReports.ProjectID) AND _
  5. (LastStatusDates.Last_Status_Date = StatusReports.StatusDate) _
  6. WHERE (((StatusReports.Status)='active')) _
  7. ORDER BY Projects.ProjectID"
  8.  
It gets the right data, but I can't update the data in the Table "Projects" but I can update the data in the Table "StatusReports" which contains all of the Status' for a given project. I want to reference the last status, hence the Query "LastStatusDates".

The later query contains a "Max" function on the date.

This code, written by someone else, did work, but apparently I've messed it up. I tried adding "Me.OrderByOn = True" ahead of this code, but no luck...

I hope I was clear. Any help would be awesome.

Thanks in advance
Apr 29 '09 #1
1 4228
Stewart Ross
2,545 Expert Mod 2GB
Hi. I have moved your post from the thread you attached it to, as the question you are now posing is quite different to the one that was previously answered.

There are many reasons why Access queries become non-updatable - so many that we have an Insight article with a link to definitive data at MSDN. The article is linked here for your interest.

Short answer in your case is that when you join your updatable table to a query that uses an aggregate function (Max in your case) the query will not be updatable. Aggregate functions such as Count, Max, Min and so on summarise data from many other rows of the table concerned, and it appears that the join to a summary row which is at a different aggregation level than the original table prevents updatability where such a function is used.

An alternative if the Max function is required is to remove the aggregate query in the base query for your updatable dataset, and substitute a calculated field that uses a domain aggregate function to lookup the maximum concerned. DMax is the domain aggregate equivalent of Max, and its use allows the lookup of a value without preventing updatability. The downside is that DMax can be slow in operation when used repeatedly.

-Stewart
Apr 30 '09 #2

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

Similar topics

3
by: dixie | last post by:
I have a form full of subforms which bring summary information onto the form from about 12 different tables. I am trying to get all of that summary information (mainly numbers) into 1 large table...
1
by: Just_Buy | last post by:
Environment: MS Access 97 Problem: Trying to force a record to update using the recordset.Update property. What syntax do I need to force a record to be updated? I have searched the...
5
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
3
by: jpr | last post by:
Hello, I know that this is not the rule but need some help. My datbase has three tables: MASTER TEMPLATES FORMS I have a form which is based on a table named MASTER. I have a primary key...
2
by: devine | last post by:
Hi All, I am trying to send an automatic email when an update has been made. My update statement will updates 6 fields, and dependant on one of the fields, I would like to send an email using CDO....
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
1
by: Dilruba | last post by:
Currently i am giving input ( as offline ) to access database locally. After the i upload the whole database. But i want to give the as online i.e. i want to give the input to the database from a...
5
by: fieldling | last post by:
I've written the following code to update a recordset but when I run it I get a Run-time error 3020: Update or CancelUpdate without AddNew or Edit. When I debug it highlights the rs.update line. I've...
4
by: phill86 | last post by:
Hi, i have a form that runs a query in a recordset on the after update method if i copy and paste one record at a time the query picks up the records in the underlying table but if i paste...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.