I have a multi-column pulldown combo box (cmb_users) that lists user names on a form (frm_myusers), the data is straight from a table called "dbo.my_users", primary key "pc_user_id", and it is the first column in the pulldown.
I then have a multi-form sub-form embedded into the parent form (frm_myusers) that contain one or more roles for each user. The data source is straight from a table called "dbo.my_users_roles" its primary key is pc_user_id. The relationship between dbo.my_users and dbo.my_users_roles is 1 to many.
The challenge I am having is When I try to bind the combobox to the sub-form I get the "cannot bind to an unbound form error"
So then I tried passing the combobox values to a query (qry_my_users_roles)behind the scenes to drive the sub-form. The criteria for the query was on pc_user_id as =[Forms]![frm_users]!cmb_users.Column(0), and I get the error below. Not sure where to go from here.
Ultimately is there a way to simply bind a pulldown to a sub-form without the need to jump through hoops passing variables to queries and refreshing? Mapping fields to query criteria can be quite cumbersome of the spelling or syntax is not absolutely perfect :(
Thanks in advance.
As the combobox is unbound, add it to the master fields:
sci_cnt_id;NameOfCombobox
and adjust the child fields as well:
sci_cnt_id;sci_own_id
Should you wish to show all records, you must maintain the field count, so use:
sci_cnt_id;sci_cnt_id
Related
I'm building a form that contains a subform to list records as a datasheet. The fields on the subform are sourced from a saved query. To the subform, I added a checkbox control to serve as a record selector.
Here is the problem: When I click on the checkbox of specific record on the subform, ALL the checkboxes on all the records display a check rather than just the one I clicked. I cannot figure out what is causing this undesirable behavior.
Any insights or suggestions to fix this is much appreciated.
Your checkbox is unbound - in any continuous form or datasheet, unbound controls have the same value for all records (how else could they be unbound?).
You will have to add a "selector" column to the record source. Only bound controls can have different values for different records.
Instead of creating a field in a table (selection-data is only temporary), you can useclsCCRecordSelect-Class from SelectRecordsV2.
It binds the control to an expression (calls a function inControlSourcethat returns the value of the checkbox, stored in a collection of the class) and uses the controlsMouseDown event to change the value (as controls bound to an expression are read-only).
That makes the selection multiuser captable and avoids creating additional selection field to tables.
I have a problem with a combobox in a form, which displays a "#Name?" error whenever I enter it to select a value.
I am creating a form in MS Access (specifically in Microsoft Office Professional Plus 2010) that is a general user interface, meaning that the form itself is not linked to a RecordSet of any kind.
In that form, I create a Combobox, which I link to a "TblSubsystem" table. The table is very simple and designed like that:
ID (primary key, autonumber)
SysShortName, text
SysFullName, text
When I try to select a value in the dropdown list, the testbox of the combobox just displays "#Name?" (actually as soon as I select the combobox, even before I select any value)
The relevant (I think) parameters of the combobox are:
Control Source= "=[TblSubsytem]![ID]"
Row Source= TblSubsystem
Row Source Type= Table/Query
Bound Column= 2
Column Count= 2
Column Width= 0cm;1cm
(I am trying to select and show the short code, but to get the ID as a value for the combobox)
I have another form in the same project, in which a identical setup (also on TblSubsystem) works just fine, with the same values for these parameters, but that Form is linked to a RecordSet (another table). As far as I can tell it is the only difference, so I guess I must be missing something around that, which will seem obvious once I see it...
I have looked for variation of "Ms Access combobox #Name? Error", on stackoverflow and more broadly on the net, but in two days, I haven't seen any post answering my questions. Some are close, but refer to a much more complicated setup, while I think mine should have been pretty straight forward. Trying to adapt the solution to my case (includind recreating the combobox or decompiling the database) didn't help.
Here it was, long question, sorry about that, but hopefully precise enough for some of you guys to help on that. I thank you in advance for any help I can get on that.
#Name is a binding issue. Try setting your bound column to one, that way it only records your primary key and see if that works.
Edit: You've got the combobox referencing your table's primary key as your control source. Keep in mind the control source is the value that is being altered by the application user. Here are some key things to think about when working with comboboxes:
The control source should (typically) reference the foreign key of your table
The row source should reference the text that you want displayed in the box
Bound column should be set to 1, unless your application design requires you to update two fields simultaneously, which is an uncommon practice.
Set your column width to 0;1. This will hide the first field in your row source, which should be your foreign key
An example would look like this:
Control Source: EmployeeID --123456
Row Source: EmployeeID, EmployeeName --123456 | John Doe
A bound column set to 1 would record the value 1234556. A bound column set to 2 would record 123456, John Doe
I have a form, the form is bound to a query which returns only one field. On that form is one combo box, bound to the field from the query, a subform object and some other unimportant stuff. The Master-Child relationship between the Form and Subform is set to that same field. The intent is that dropping down the combo box allows me to add information on the subform pertaining to that record in the combobox (it's a list of classes in a school, for context). This is done through a form and subform as I have various different tasks that need to be done for each class - the intent is to be able to select a class on the main form and then use command buttons on it to select which subform is opened depending on which task I wish to perform.
However, the Combo box appears to be trying to update a table - I'm not sure which one as the error message isn't specific:
The changes you requested to the table were not successful because
they would create duplicate values in the index, primary key or
relationship. Change the data in the field or fields that contain
duplicate data, remove the index or redefine the index to allow
duplicate values and try again
appears if I select any value other than the first one from the combo box and then click in the first text box on the subform. However, I can click in the subform with the first entry in the combo box selected and add data successfully, I've checked and it is appearing in the underlying tables.
It seems to me, as a relative novice in Access, that the combo box is attempting to update the underlying data source when it is changed, though it has no macros. I would assume there are items in the properties of the form or the combobox that prevent that from happening but I can't find them. That is just a guess as to what's happening, though, and I could be wrong.
It's possible that this is related to this question but I could be mistaken there as well. Regardless, the Form shouldn't be able to update/edit/add records but if I set Allow Edits in its properties to "No" I am unable to actually select a value from the combobox - I have set the other "Allow" properties to "No" without a problem.
If you change anything in the main form and then click on the subform then Access will try to save the data in the main form automatically. Maybe you can try to temporally exchange the combo box with a text field for testing. That should help you to clarify the problem.
I have a form, that holds a subform which displays data from a simple query based on the content in a input field.
I have set the properties of both forms to the following, but I still experience the "Recordset is not updatable" message.
Recordset type: Dynaset
Allow Additions: Yes
Allow Deletions: Yes
Allow Edits: Yes
Allow Filters: Yes
Record Locks: No Locks
What to change?
Perhaps one of the tables or queries that your query links to do not have Primary Keys.
OR (and this was the problem I had)
In the Query Builder, make sure the Group By row is not enabled. When you disable this then the query will become editable.
Group By Enabled
Right-click on the row and disbable Totals
Group By disabled
This page has some good info for troubleshooting.
Make Text0 unbound (remove Navn as the Control source). You have what amounts to a circular reference.
You're telling the form not to show any data except what is limited by the query, but you're having the query not show any data except what is in your form.
I ran into this issue and it was due to relationships between the tables. I had a few set as Indeterminate and believe this was causing the issue. Once I modified my table relationships so that all were One-to-Many, I was able to edit fields in the query/form.
-Note that to have a one-to-many relationship, one field in the relationship must be a key or set to Unique.
I encountered this error with a Access 2016 form created with the form wizard.
It set some variables like Data Entry to No.
But what locked the form from edits was the filter and sort.
I had to tell both the filter and sort 'No'
When I reopened the form nothing was showing.
I filtered on something then cleared filters.
Now the form is working.
In my case I made a table where I joined the possible combination mixes from various other tables with a number of corresponding many-to-one relations. In the subsequent query using just this one combination table it became unupdateable if I checked the "Unique Values" in the query's property sheet. It works ok checking the "Unique Records".
The downside is that when filtering on one of the combination fields in the query I now get all those lines (records) from the combination table where this particular field has got the filter value. I wouldn't get that if I checked the "Unique Values".
I guess the solution is to make two separate queries: one unupdateable for just querying and then a copy query (except for unchecking "Unique Values" when updating is required).
At least you get your relationships right.
corrupted tables can sometimes lose their primary keys and that could be the cause of "Recordset is not updatable" message.
I found the same issue with a recordset not updatable but it seemed intermittent. The subform recordset was updatable, then it was not. When it was not updatable, I had to go back to an early copy of the database. In the earlier copy, the recordset was updatable. What I found was that if I sorted the subform data and closed the form, access saved the "Order by" clause in the subform properties - I never ran any command to save the subform. With this "Order by" set, the subform recordset was not updatable. The Fix: I added an initialize routine to all subforms to remove the order by, before the main form is opened. Wala! Recordset of subform is now updatable every time.
Above Allow Additions: Yes you should have something like
Allow datainput. Make sure this field is set to false. If you read the status bar comment when you have this field selected you will understand why your table suddenly became unediteable from your formular :)
On a form, I have a combobox, with the RowSource coming from a query (specifically, a calculated field in the query). When the user makes a selection, I want to update a label on the same form with a different column from that same query, but of course associated to the selection.
I'm fine with VBA and writing queries and whatnot, but I am not very familiar with Access forms.
By the way, I tried searching for an answer to this, but it was quite difficult because I don't know what this thing is really called that I am trying to do. A good link to a site explaining this would be perfectly fine (no need to write a bunch of stuff here if it already exists elsewhere).
In the After Update event of my combo box, cboUserID, I can set a label control, lblFoo, to the value of the second column in the selected row of the combo.
Me.lblFoo.Caption = Me.cboUserID.Column(1)
If your combo box is bound to a field in the form's record source, you may want to do that same operation from the form's On Current event also.
You can use the column property to refer to anything other than the bound column of a combo.
Rowsource: SELECT ID, SName, FName FROM Table
Me.MyCombo.Column(2)
This would return FName.
-- http://msdn.microsoft.com/en-us/library/aa224084(v=office.11).aspx
Me.MyLabel.Caption = Me.MyCombo.Column(2)