Hi All
Windows XPPro
Access 2002/2007
I have a form whose recordsource I build dynamically using VBA. Various controls are bound using controlsources.
The form's table has 3 'Identity' fields:
1) Unique_No - Autonumber - Indexed - No duplicates
2) Rec_ID - Long Integer - Indexed - Duplicates OK
3) Version - Long Integer - Not Indexed.
Use of these fields permits several generations of any particular record, that is to say that when a record is edited a new version can be created. A 'family' of versions is identified by the Rec_ID field... e.g.
Unique_No 12787
Rec_ID - 12787
Version - 1
Unique_No 12834
Rec_ID - 12787
Version - 2
Unique_No 12901
Rec_ID - 12787
Version - 3
These are effectively the same 'real world' record which has three generations. Any given record can be accessed using it's unique no.
In order to display the latest generations [only] of records from any given table, I set the form recordsource as below:
SELECT Tbl.* FROM (( Tracks As Tbl ) INNER JOIN (SELECT max(Version) as Max_Version,ID FROM Tracks GROUP BY ID) AS Max_Results ON (Tbl.Version=Max_Results.Max_Version) AND (Tbl.ID=Max_Results.ID)) WHERE (Tbl.Deleted=True or Tbl.Deleted=False) ORDER BY Tbl.Name
I was kindly helped with this, rather cunning, query by one of the forum members and it works brilliantly!
However, when I try to edit any detail in my form, Access informs me that "this recordset is not updateable".
From my research, I think use of the GROUP BY is causing this.
Can anyone suggest a work around or possibly another method of extracting the highest versions of records?
Thanks in anticipation.
Windows XPPro
Access 2002/2007
I have a form whose recordsource I build dynamically using VBA. Various controls are bound using controlsources.
The form's table has 3 'Identity' fields:
1) Unique_No - Autonumber - Indexed - No duplicates
2) Rec_ID - Long Integer - Indexed - Duplicates OK
3) Version - Long Integer - Not Indexed.
Use of these fields permits several generations of any particular record, that is to say that when a record is edited a new version can be created. A 'family' of versions is identified by the Rec_ID field... e.g.
Unique_No 12787
Rec_ID - 12787
Version - 1
Unique_No 12834
Rec_ID - 12787
Version - 2
Unique_No 12901
Rec_ID - 12787
Version - 3
These are effectively the same 'real world' record which has three generations. Any given record can be accessed using it's unique no.
In order to display the latest generations [only] of records from any given table, I set the form recordsource as below:
SELECT Tbl.* FROM (( Tracks As Tbl ) INNER JOIN (SELECT max(Version) as Max_Version,ID FROM Tracks GROUP BY ID) AS Max_Results ON (Tbl.Version=Max_Results.Max_Version) AND (Tbl.ID=Max_Results.ID)) WHERE (Tbl.Deleted=True or Tbl.Deleted=False) ORDER BY Tbl.Name
I was kindly helped with this, rather cunning, query by one of the forum members and it works brilliantly!
However, when I try to edit any detail in my form, Access informs me that "this recordset is not updateable".
From my research, I think use of the GROUP BY is causing this.
Can anyone suggest a work around or possibly another method of extracting the highest versions of records?
Thanks in anticipation.