Mar 25 2024 06:54 AM
Hi all - silly issue that somehow I can't get the answer to. Any help is appreciated.
I have an Access database (dataverse backend). I'm using a data entry form, which works well.
There are a variety of input field, some are comboboxes all working well, except 1 issue I have. One of these comboboxes is linked to the same table as I'm editing with the form. It has a row source query "Select RiskNames from blurb" and linked to the RiskNames as control source.
That all works as expected and the combobox shows results and auto expands, until I create a new record (DoCmd.GoToRecord , , acNewRec). Initially the combobox still has values (clicking the drop down shows them) , but as soon as I enter any data in any of the other columns, the combobox values are gone (drop down empty). I've used a cmbbox.requery event (in the cmbbox.gotfocus event) to try and reset the row source- this doesnt help. also with VBA I tried to change the rowsource to the query, also to no effect.
I suspect somehow the table is locked or some while a new record is being added, blocking the combobox to requery the original table.
The behaviour is as expected when just editing an existing record.
Any ideas how to solve?
Mar 25 2024 12:04 PM
Show us the SQL from the row source for the combo box.
Show us the SQL from the record source for the form.
Is the form in Datasheet view, Continuous view or Single Form view?
Mar 25 2024 12:42 PM - edited Mar 25 2024 12:48 PM
thanks for your reply.
The form recordsource is: SELECT * From Policies
The rowsource for the combobox is:
SELECT Policies.Risk_Name
FROM Policies
GROUP BY Policies.Risk_Name
ORDER BY Policies.Risk_Name;
It's a Single Form.
Ps the control is linked to Risk_Name too
Mar 25 2024 12:57 PM
Mar 25 2024 01:35 PM
Mar 25 2024 01:52 PM
No, I mean a second table called "Risk_Name". It is a "Lookup Table" because it has only the values you need for "Risk_Name". You use Lookup tables to provide a closed list of possible values for "Risk_Name" which you control. It limits users to only those values provided in that table. What you are doing actually allows for any previously entered value to be repeated, whether it is appropriate or not because it is based on the values already in that field in the Policies table. Once a value is entered, it continues to be offered.
Lookup tables are standard Access design. Dataverse is designed to make it more opaque what is going on, but the same concept is available there.
Mar 25 2024 01:58 PM
Mar 25 2024 06:15 PM
SolutionMar 26 2024 02:38 AM
Mar 25 2024 06:15 PM
Solution