Using a checkbox on a form to flag record for export - forms

I have a MS Access 2010 form with a query as the record source. I want to display all records that the query returns, and give the user an option to check any number of boxes, and when finished, a) export all the checked records to MS Excel, and b) hide those records from the form the next time it is opened.
I have tried to do this with unbound checkboxes on a continuous form (dynaset recordset type), but when I check the box for one record every checkbox for every record becomes checked, not allowing me to choose which ones I want to export individually.

You can't do what you want with unbound checkboxes. Unbound controls are called that because they are not bound to an individual record. You have two main options:
Add a Yes/No field to your table
Add a yes-no field to your table. Bind the checkbox to this new field.
Use this approach if you want your other fields to be "edit-able" and you can make changes to your schema.
Use a multi-select listbox
Switch your form from continuous to single and add a multi-select listbox. Then loop through the selected items to create an IN () clause for your export query.
Use this approach if you don't want to make changes to your schema. Also, you can set the listbox to accept Shift-Click selection of many contiguous records. That may be less labor-intensive for your users.

This is possible with the clsCCRecordSelect class from Bitsqueezer's SelectRecordsV2 database! It's a must-have for selecting records in a continuous form!

Related

Checkboxes firing on all records instead of the selected record

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.

How to store DLookup from [Form] to Table Field in MsAccess 2013?

I have two MS Access tables: IdMhs and T_UKT. I want to automatically fill in [IdMhs].[SPP] from some criteria in [T_UKT].[UKT]. I cannot put it in query relationship, because the row cannot be edited on a form.
So I make a form and I get the number SPP (a textbox on form) automatically by using and it works fine:
=DLookUp("SPP";"T_UKT";"UKT = " & [Form].[UKT])
The problem is: the lookup value just shows on the form, and the results are not filled in the field in table ([IdMhs].[SPP]).
Any idea what an expression I should write to fill it in IdMhs table automatically?
Need macro or VBA code to save value into table. If form is bound to IdMhs table, simply like:
Me!SPP = Me.tbxSPP
The real trick is figuring out what event to put the code into. You have a control (possibly combobox) where the UKT value is selected? Use its AfterUpdate event.
Why do you need to save the SPP value and not just retrieve it in a query that joins tables?
What is nature of table relationship? Is T_UKT a lookup table? If so should be able to include it in form RecordSource and then the SPP value would be available for display in textbox and DLookup not needed. Domain aggregate functions can perform slowly on forms and reports and should be a last resort option. The same code would be used to save the value. The query join should be 'show all records from IdMhs and only those from T_UKT that match'. Set textbox bound to T_UKT SPP field as Locked Yes, TabStop No.

Combobox governing subform possibly updating tables

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.

Cannot see records in form bounded to table in Access

I have a form and it's record source is a table. I created the form separately and added the control sources to the different fields in the form and also changed it's record source. I imported values from an excel sheet into the table and when I open the form, I do not see the tabe values being displayed in the form. Any idea what I should do to see the table records in the form?
In form design mode, check the form's DataEntry property. It sounds like yours is set to Yes, which hides existing records and only allows new entries. Change it to No and you will see the existing records.
Another possibility is that a filter is active and no records match that filter.
Use a form wizard to generate a working form based on your table. Then once you can see the data being displayed in the form, customise as needed.

How do I gain Control of a row in Tabular Layout in Oracle

This might be simple but I am new to Oracle. I am using Oracle 10g and have a form that lists our information from a linked table in a tabular Layout. The last column of data is a "list Item" item type that has the Element list of Enabled (T) and Disabled (F).
What I need is when a user changes this dropdown, to disabled, I want ONLY that row to have some of the columns be disabled and not the entire column.
This is also assuming on load of the form, it will disable and enable rows of data depending on what values are being pulled from the EnabledDisabled column in the database.
Thanks for the help!
Option 1: use the ENABLED item property.
Unfortunately Oracle Forms does not allow changing the ENABLED property of an item at the item instance level.
What you can do, however, is enable or disable the whole item when the user enters a record - use the WHEN-NEW-RECORD-INSTANCE trigger - depending on the value of the current record's value for the list item, the trigger would set the ENABLED property to PROPERTY_TRUE or PROPERTY_FALSE.
Of course, your list item would also have the same code in its WHEN-LIST-CHANGED trigger.
The downside to this approach is that the whole column will "look" disabled to the user, and they will not be able to select a different record using those disabled items.
Option 2: use the INSERT_ALLOWED and UPDATE_ALLOWED properties.
You can set these properties at the item instance level using SET_ITEM_INSTANCE_PROPERTY. You would set them in the block's POST-QUERY trigger, as well as in the list item's WHEN-LIST-CHANGED trigger.
This would not, however, change how the items look on the screen. To solve this, you could also set a visual attribute at the item instance level (e.g. change the items to use a dark gray background or something).
More comments.