Bound controls

So far, the only kind of user interface control you have used on your forms has been the text box. However, ACCESS provides other controls (such as combo boxes, list boxes, check boxes, radio buttons, and so on) that can be used to improve the attractiveness and functionality of your forms. These interface elements are called bound controls because they are bound to fields in the underlying table. When you change data in a bound control, you are changing the data in the underlying table. In this lesson, we are going to focus on a particularly useful bound control: the combo box. A combo box is list of values from which users can select a single value. Not only does selecting from a list save typing, it can be used as a means of enforcing referential integrity since the users choices are (typically) limited to the values in the list. (pdf file, install Acrobat Reader to read this tutorial)

Sponsored Links:

Related Topics

Bound Form - Manual Recordset Update?
I have a bound form with bound text box controls. I would like to have SAVE button so the record can be updated in place. However, it seems binding the form and controls to a recordset prevents and in-place save. Is this a limitation of using bound controls


Bound Form - Manual Recordset Update?
I have a bound form with bound text box controls. I would like to have SAVE button so the record can be updated in place. However, it seems binding the form and controls to a recordset prevents and in-place save. Is this a limitation of using bound controls?


Locking bound controls
How to prevent users accidentally overwriting data in a Microsoft Access database by locking the bound controls on a form. Handles subforms recursively. Allows you to specify controls that will not be unlocked.


Bound controls "mis"behaving
When I open a form I would like the bound controls to be unpopulated until after I choose the appropriate record.

What I am getting is the bound controls populated with the data from the oldest record, lowest autonumber, in the linked table. Very unprofessional effect to always have the same person's data show up whenever the form is opened


Force SQL update on a bound form
I am trying to force a bound form to execute an SQL update (and a few housekeeping tasks) before I navigate to the next record, even if I am only updating an unbound control (listbox). The beforeUpdate event only seems to fire if I change one of the bound controls on the form. I have to have both bound and unbound controls (I think) because there is a many-to-many relationship between the bound record and the items in the listbox (so I am using a collection table).

If anyone could provide some information on a possible solution, or some better definition on the event order when the form's navigation buttons are clicked, I would be greatful. I am using Access


Data Set not Refreshing after Delete
I have two textboxes and a combo box all bound to columns in the Reminders table. My ADD and UPDATE buttons work perfect, and refresh the data in my bound controls afterward.

I cannot for the life of me get my DELETE button to refresh my bound controls after I click the delete button and delete a row. The deleted row is still in my controls until I exit from the form and reenter.

I have tried clearing the data set, re-filling, etc. I cannot get anything to work.


Using a Form to save data from one Table to another
There is a public master database with a bunch of tables and data in it being maintained by another group. Need to skim some information from this, add some of information to it, and save it in a completely separate .mdb file on our server.

I've used Access to link to the public database, built a custom table just for us, and built a form. The form uses bound controls on the left side to pull in data from the public database, and unbound controls on the right side for user entry of data.

I coded a VBA save button that should save all controls (bound/imported as well as unbound/data entry) to our local table.

The unbound controls save just fine, but the bound controls are missing from the table. A new row is created with no problems, I get no error messages, but half the fields in the table are just blank.


Not all controls in bound form writing to table
I have a form called "Test Entry" that has about 10 bound controls (both combo and text boxes) that write to their corresponding field in the table "Tests". I created an"on click" embedded macro tied to a command button as follows:

If [Form].[Dirty]
RunMenuCommand
Command SaveRecord
End If

Everything was working very well. I then added two new text box controls (txtStroke and txtSpeed) that are bound to their corresponding fields (Stroke and Speed) in the table "Tests".

When I save the record using my command button, all my entries except for txtStroke and txtSpeed are saved to the table "Tests".

Obviously operator error, but I've looked and looked for any difference between my new text controls (txtStroke and txtSpeed) and the other text controls that are working properly but cannot find any differences.


Working with the New Data Source Controls in ASP.NET (Part I)
With ASP.NET 2.0 and after, you are introduced to a bunch of new data source controls, i.e., LinqDataSource, ObjectDataSource, XmlDataSource, SqlDataSource, etc. You can use the newly added data source controls of ASP.NET 2.0 to implement CRUD (Create, Read, Update, and Delete) operations in your applications without having to write much code. All of these controls support paging, sorting, caching, editing, inserting, selecting and deleting data. You can use these controls to bind data to your ASP.NET data bound controls (GridView, Repeater, ListView, etc) declaratively, i.e., without writing even a single line of code. This article discusses these controls and how easily one can work with them.


Unlock form by default and user can manually lock it
I'm currently using Access 2007 and I would like to lock down controls in a form with a button, I read about some pretty clever coding for locking bound controls, but it doesn't quite fit my needs. The new forms usually open in a locked state (which bothers me a bit since data will be added regularly), while some blank textboxes, that the user has to fill by himself, are not locked at all.

I would like the form to open unlocked by default (or at least apply no locks on a newly created form), so that the user can manually lock all the controls, bound or unbound, with a click on a command button, after he's finished. Maybe it's not kosher with Access, but I'd prefer to avoid heavy programming in VBA...


Combo Box Properties (2003)
I have a sub form on which there are 3 different sets of controls. Only 1 set will be visible by the user depending upon a selection made in the 2nd control on the form. I am trying to sue the visible property and change it in VBA depending upon the 2nd control. e.g.
....
However each time I run it I get the message error #438, Object does not support this property or method. The 3 controls being changed consist of 2 unbound combo boxes and 1 unbound text box (they would all be bound to the same fields which is why they are currently not bound. I will update the actual table later when all the data has been entered.

I am sure I have done this before but stupidly cannot remember how.


Multi-select images for report - create array?
I have 10 unbound image controls on a form and below each I have a bound radio button. On my report, I have 5 unbound image controls. The user selects multiple images on the form with a maximum of 5 selections.

Let's assume the radio buttons representing the image controls on the form are named 1-10. Let's also assume the image controls on the report are named A, B, C, D, E.

In all cases, image control A on the report will contain image 1 and image control B will contain image 2. For C, D and E they would display the remaining selected images from the form. How these images are ordered is not important.

How can I dynamically assign the remaining selected images to image controls C, D and E on the report?


Unbound combobox AfterUpdate
On some form I have several unbound combobox controls. Whenever some of them is changed, I want:
1. reset the values for other combos on same form;
2. reset Filter and FilterOn properties for subform on same form;
3. reset Rowsource for a record locating combobox on this subform.

Currently I use combo's AfterUpdate's events for this - like:

[CODE]

The problem is, those events are fired whenever something on combo is selected - even when the combos value really remains same.

I want, that event will be fired only, when some combo's value was really changed, and I can't use OldValue property here, as this works only with bound controls (for unbound controls it is always same as controls current value). So I need something along lines:


Attachment control - How to use?
On the form, I have a listbox for the user to select a specific record. When an item is selected, I use Set rst = CurrentDb.OpenRecordset(sql) to open the record. I then populate the controls on the form with the following formname.controlname.value=rst!field

I can't figure out how to load the Attachments into the Attachment control. I tried searching here and online and did not find much outside of using a bound control. I do not want to use a bound control/form if I can avoid it.


unbound text box data not appearing in print preview
I have a form with some unbound and bound controls. The form has a record source. When the form is run and controls are populated via a query (the recordsource), the user enters data in some unbound controls. The form also has a button which displays in print preview mode.

When the custom print preview button is clicked, the data from the unbound controls do not appear in the preview. But if I use the file-print preview menu item, the data is properly seen.

Below is the code written in the button click to display print preview

DoCmd.SelectObject acForm, "AnswerForm"
Printer.Orientation = acPRORLandscape
DoCmd.RunCommand acCmdPrintPreview
DoCmd.Maximize

I am unable to figure out why this behavior is happening. Any help with this is appreciated a lot.


The Windows Controls of a Form
A typical database is made of forms (and reports) and these objects are equipped with Windows controls that allow a user to interact with the computer. To create such a database, you add forms and reports to it. Then you populate them with the necessary objects. This is the essence of application design and you should know how to design the controls.
Form and report design consists of populating them with the necessary controls that would allow a person to use your database. To perform this design, you first open the form or report in Design View.
Topics: Control Design, Common Properties of Controls, Tables Columns and Windows Controls, Common Methods of Windows Controls, Common Events of Windows Controls, Windows Controls: The Label, Windows Controls: The Group Box, Windows Controls: The Text Box, Windows Controls: The Month Calendar, Windows Controls: The Date Picker, Windows Controls: The Time Picker, Windows Controls: The Command Button, Combo and List Boxes, Check Boxes and Toggle Buttons.


Can not add more controls to a report
I have not counted the individual controls on my report but it is possible that I have reached the 775 limit for the number of controls for Access 2003. Is there a way for Access totell me how many controls are on the report?

I have tried to delete controls from the report, save it as a different name, compact and repair the database and save the form into another database before attempting to add back the same group of controls I originally deleted from the form.

I have also tried adding a subform to replace the group of controls I deleted. I still get the error:
Microsoft Office Access can't create any more controls to this form or report. If you have deleted controls from this form or report in the past, you may be able to rename the form or report and then add more controls to it.

Is there something else I can try?


Receiving error 2046 upon closing a bound form
I have a small bound form that is connected to a single table only. I open it in data entry mode (Data Entry = Yes) from a larger form in my application after a particular text box has been updated.

The value from that text box is passed into the bound form via OpenArgs, and becomes the entry for one of the text boxes in the bound form. This establishes a new record, and theuser is then to fill in the remainder of the boxes on the bound form.

In the interest of enabling the user to cancel the data entry and leave the bound form, I placed a command button on the form with this code attached to it:


Create a calculated control
You can use calculated controls to display the results of a calculation. For example, if you have a report that displays the number of items sold and the price of each unit, you can add a calculated text box that multiplies those two fields to display the total price. The Control Source property of the calculated text box contains an expression (expression: Any combination of mathematical or logical operators, constants, functions, and names of fields, controls, and properties that evaluates to a single value. Expressions can perform calculations, manipulate characters, or test data.) that multiplies two fields (the number of items times the unit price) to obtain the result.
What do you want to do?: Create a calculated control, Change a bound control to a calculated control, Learn which types of controls can be calculated controls.


Text Box control and character limit?
I have an unbound text box on a form. The form is bound to a query but only for reading records. The unbound text box is programatically populated with data from the form's recordset. If the text gets around 2038 characters long trying to save via the form produces the error "could not update; locked by another session on this machine." I can still update via the table, just not the form. Also, if I have the form viewing the record containing this long text then even via the table it says the record is locked and cannot be updated.

**The field in question is in its own table because it is a memo field that gets changed regularly in production. The production environment has this as a bound control but I am trying to implement unbound controls to avoid excessive record locking.**

Is there some limit on text controls regarding length of text? I cannot find anything by googling or searching this forum