Question

So I started a new job, and have inherited an absolutely atrocious collection of databases tied to several access front ends. While attempting to create a testing server, I've run into an issue with the front ends. The previous developer created some access forms tied to tables and views within SQL Server 2008 r2. I'm trying to figure out why I cannot edit any of the values in any of the fields (text, combo boxes, lists, etc).

The View that the form is tied to is:

AuditQueries_UserTableForSelectionForms

The view looks similar to:

SELECT        TableForFormFields_1.FormSelectionID, TableForFormFields_1.JobPlan, TableForFormFields_1.Floor, TableForFormFields_1.Location, TableForFormFields_1.CHSR#, TableForFormFields_1.PanelName, 
                     TableForFormFields_1.PanelLetter, TableForFormFields_1.PanelCircuit, TableForFormFields_1.StartDate, TableForFormFields_1.EndDate, TableForFormFields_1.MigrationDate, TableForFormFields_1.JTag, 
                     TableForFormFields_1.MinBusRow, TableForFormFields_1.MaxBusRow, TableForFormFields_1.PlanID, TableForFormFields_1.Equip, TableForFormFields_1.CabinetJTag, 
                     Shared_Tables.dbo.username.[User]
FROM            Audit.TableForFormFields AS TableForFormFields_1 INNER JOIN
                     Shared_Tables.dbo.username ON TableForFormFields_1.FormSelectionID = Shared_Tables.dbo.username.[User]

TableFormFields is a table containing the default values for all the fields across the various forms, and it changes based on the logged in user. The logged in user is detected using the following view:

SELECT        CASE LEFT(SYSTEM_USER, 11) WHEN 'LIGHTHOUSE\' THEN SYSTEM_USER ELSE 'Webuser' END AS [User]

I have Googled the error, and all the documentation I've found doesn't seem very pertinent. There are other forms in the database tied to Tables that appear to work, and if I change the data source of the form to:

SELECT * FROM TableForFormFields AS TableForFormFields_1

Everything works as required. However, this diverges from the production environment, and I need to keep them the same, or at least as close as possible. Any ideas?

Was it helpful?

Solution

They query (and thus the recordset which is populated by the query) is not updatable because of the JOIN. When you have a join the form or datasheet or whatever is using the query cannot resolve where your changes will go. If you want your recordset to be updatable you will need to reference one table.

The ControlSource for comboboxes/listboxes etc is the property which tells data where to be written when the record is saved. It is a field in the form's RecordSource.

A control's RowSource property is what tells the control what to display as available options.

In your case you should set the RowSource to the view which serves up the relevant data and set the ControlSource to the record in the table which will be updated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top