Combobox Running Code/Query throwing "Recordset is not updateable" - sql

When I click the Combobox, the dropdown list is populated, yet when I try to click on an option it says "Recordset is not updateable".. I have tried to read up on this error yet can't identify the issue behind this. The joins aren't complicated and it has worked before. The query source for the AwardsSubFrm is attached:
Anyone know how to fix this?

The image of the query design indicates your record source is a GROUP BY query. The recordset from any GROUP BY query is never updateable. You can verify that point by opening the query in Datasheet View of the query designer and confirm Access won't let you change any of the values.
I don't know what the fix is for your situation, but you need something other than just a GROUP BY query. Perhaps a subform whose record source contains the table rows you want to update, and link it to the main form so it displays those records which are related to the current main form row.

Related

Drop-Down Box in a Selection Query - MS ACCESS

I'm working on a selection query in my Access database. in one of my columns I wanted to have a drop-down list with selected data. Unfortunately nothing is showing, and I'm thinking about two Problems that can be responsible for this :
The selection wont show up until I link my query to a table where I can modify and select from the drop down list.
I made a mistake in developing but can't find anything about that mistake
Here is the details of whats going on :
What I want
This image is just the result of my query not linked to a table
What I have
Is an actual drop down list without any data in it (still talking about the result of the query not linked to a table in which modification can be made directly)
Here is What I did
Added the queries and tables I'm working on and then =>
Selected the column I wanted it to be a drop-down list and then added the following query after changing it to a drop down list
SELECT [SALARIE_nom] & " " & [SALARIE_prenom]
FROM (T_STATUT_EMPLOI INNER JOIN T_SALARIE_EMPLOI ON T_STATUT_EMPLOI.STATUT_EMPLOI_id = T_SALARIE_EMPLOI.SALARIE_EMPLOI_statut_id) LEFT JOIN R_Select_Salarie ON T_SALARIE_EMPLOI.SALARIE_EMPLOI_salarie_nni = R_Select_Salarie.SALARIE_NNI
WHERE (((T_STATUT_EMPLOI.STATUT_EMPLOI_statut) Like "*validé*") AND ((T_SALARIE_EMPLOI.SALARIE_EMPLOI_Entreprise) Like "*RTE*"));
if I run the sql query on it's own, it gives me the results I want but when trying to see this result in the final table (result table of my query) I got the blank drop-down list.
here is the result I get from executing the query alone :
So I think it's working.
Thank you in advance for reading my explanation and for your comments
I think that everything was fine, and that it was just a bug. After linking my query to a form I started seing the data in the drop-down list in both the form and query.
But I still Have one small issue which is :
Not being able to modify or choose from my drop-down List.
What I did
I created my form using Forms Assistant in access and then I chosed as data source my query. But I can't modify my form or anything could please suggest something to me.
Thank you !

Access 2013 query only pulls the first record

i'm hopeing someone will be able to solve this. I have a combo box which shows the records that are available to view. Upon selecting a record, my query updates without any problem. I tried to use this query within a subform however, for some reason, only the first record in the data set is shown upon selection. When I select anyting else from the available options, the subform doesn't change. However, when i re-select the first record, it shows.
The weird thing is, that when I change the drop down box to say the 2nd record & run the query itself, the desired record shows within the query designer.
To explain further: the combo box is called searchByAcc_cb. This is set so that it retrieves the account name & various other fields from the same table. Below that, there is a subform which is set to requery once another account from the drop down box is selected. When I select the 1st account, the record shows. However, upon selecting the 2nd account, 3rd, etc, nothing shows. I can then re-select the 1st record & i see the account information - so i know it's not a problem with the form updating.
The other strange thing is that upon selecting another account within the drop down box & then running the query from the query designer, the account information is retrieved for the 2nd / 3rd 4th record within the datasheet view. So, i know it isn't a problem with the query.
Any ideas on how to resolve? I've tried deleting the subform & re-inserting it (ensuring that the names match).
For anyone else struggeling with the same problem, I managed to resolve it: You need to delete any reference to the child / master fields within the subforms properties.

MS Access - Query bringing in "new record" row

I have a query that will be populating a form and then the form will allow the data set to be edited. The issue I am having is that the query is pulling the last row that is normally used to add a new record. This results in having a row that looks shows all fields as blank, but leaves one field with "null".
I played around with the query and was able to find a workaround by selecting "distinct" records, problem is that when you select with distinct, you cannot edit the data set. Is there any other way around this?
I can upload an example of the database if needed.
Thanks!
edit: picture to show the issue: https://imgbomb.com/i/?rO1sp

MSAccess: Change in subform recordsource causes loss of LinkChildFields binding

I have a problem that Im completely stumped by. Or rather, I have a work-around that is messy and I don't understand why what I want to do doesn't work:
I have a mainform / subform nest. The subform is linked by master/child fields (neither form is editable- so Im using the recordsource field directly rather than a separate control). The subform is a continuous form; so the subform displays the records related to the master in the mainform when the current record changes. The subform is based on a query- there are no parameters or filters being applied- the query presents the recordset exactly as needed. This all works perfectly (in that when the record of the mainform changes, so to do the related subform records).
Problem arises when I want the subform to be based on a different a different query (ie based on different tables)- but with the same unique-key (the 'ID') and fields as the original query. The queries all work fine, and displaying them in the form works fine.
The issue arises when I change the recordsource of the subform (so from QueryA to QueryB). The records the subform are correct (ie the query results are displayed as expected)- but the LinkChildFields is no longer functioning: the subform no longer shows the related records from the query- it displays them all. In other words, the form displays the entire recordset as if I had no LinkChild / LinkMaster set.
So, the code in the AfterUpdate event of the toggle control in the MainForm is ;
Private Sub optActRep_AfterUpdate()
Select Case Me.optActRep
Case 1
MainFormSubFormControl.Form.RecordSource = "QueryA"
Case 2
MainFormSubFormControl.Form.RecordSource = "QueryB"
End Select
Ive debugged and the property 'linkchldfields' is still set correctly ('ID'). Ive tried setting these to vbNullString before the recordsource update and resetting after the recordsource update (same issue). The odd thing is if I update the linkchildfield property in the mainform (in the Current Event)- then it works and seems to fire. So,
Debug.print Me!Subform.LinkChildFields
correctly returns 'ID'. The only way I can make it fire is by coding;
Me!Subform.LinkChildFields = "ID"
into the Current event of the Mainform (ie so that every time the MainForm record changes, the correct QueryB record is displayed)... even though Im only setting the property to what my debug is telling me it is already set to. Its as if it no longer fires.
Very confused.
Access continues to do the daftest things.
Nothing to do with the form setup at all. The underlying query (QueryB) was based on a Crosstab query. Whilst the query worked fine independently of the form (including when directly using the query as the forms record source), it obviously didnt like using the product of one of the fields as the Unique key (even though it was the same format type and Grouped / Row rather than being a cross-tab field).
I changed the crosstab part of the query to a Grouped query (using IIF & Sum to manually create the Crosstab-equivalent field values) and the form now works fine.
My lesson learnt- don't use Crosstab queries! Apologies for the red-herring.
Surferosa
Apologies for the late reply, I only found this thread when I encountered problems similar to yours. I'm not sure the Crosstab query is the cause of your problem.
I can set LinkMasterFields to be either a column name or a control name.
I can only set LinkChildFields to be a column name, setting it to a control name does NOT work. Ouch.
You can change LinkChildFields in the sub-form control either in Design View or via VBA, but in many cases Access continues to use the previous value even though it displays the new value. This is true for sub-forms whose record source is either a table or a simple two table query. I do not have the time or the patience to characterise this problem any further. Sorry !
My solution is to set LinkChildFields in the sub-form control to a value e.g 'ID' and then create an alias with that name in each and every record source used by my different sub-forms. Then you only need to change the Source Object when you switch sub-forms.
Hope this helps !
HB

MS Access 2010 Form with check box per record

I'm trying to create a form that allows my audit team to help identify transactions that need further investigation.
Is the following is possible? If so what would be the best method for accomplishing this? I would like to have a check box in a form for each record that is returned from a query. That check box would then be used to identify records that would be appended to another table.
I've done this in the past for forms linked to temporary tables; however, since this form is linked to a query I think I'm having an issue.
You could add the checkbox to the form and use some VBA code to insert all those rows from the query into another table that have the checkbox checked (Forms!MyForm!myCb = True)