The Difference of Bound and Unbound Form In Access

The Difference of Bound and Unbound Form in Access

 There are bound/unbound fields or bound/unbound forms that we usually see in the MS Access file. The bound form is the form that links or connects to the table. All data that display in the form are linked to the table. If you change any data in the form then it will change in the table as well. The unbound form is a blank form that is not connected to any table. When the form is opened there will be no data displayed. The Login Form is an example of unbound form.

If needed, you can learn How to Create an Access form at: http://www.iaccessworld.com/how-to-create-form-for-beginner/.

The Design View of Bound

 The form below is a customer form. This customer form is the bound form which has a Record Source of tbl Customer table. Under the form design view, the field name will display on the white text box next to the label on the left hand side.

The Customer_ID is linked to the Customer_ID field in the tbl Customer table.  

Many scientists and doctors consider that the sphincter of Oddi on line cialis into the duodenum. Once you have found an herbal supplement that you’d like to try, tell your physician about it. viagra on But even the slightest imbalance in your body can lead to divorce, breakup and conflicts viagra ordering on line http://www.devensec.com/development/Devens_Reuse_plan.pdf in relationship. Every 7 in 10 users recognized the efficacy factor of kamagra online levitra tablet for erectile dysfunction.

The Design View of Unbound Form

The form below is the unbound form which does not have the Record Source assigned to any table. We use the unbound form to add textbox or any field does not link to the data in any table. Under the form design view, all text boxes display “Unbound” which means there has no Record Source of the text boxes.

The text box of CustomerID label does not link to any field since this form does not have the record source assigned to any table.

We can name “txtCustomerID” to the text box of CustomerID label and “txtCustomername” to the textbox of CustomerName label and so on.

The Form View of Bound Form

When the bound form is opened, the 1st record of the tbl Customer table will display on this bound form. The data on this form is linked directly to the tbl Customer table. The data will be automatically saved if there is any change in this form. If you delete any information on this form, it will be also deleted from the tbl Customer table as well without using any VB code.

Add Combo Box

There are three options on the Combo Box Wizard when you try to insert the combo box on the bound form as shown in the picture below. We select the 3rd option of “Find a record on my form based on the value I selected in my combo box” in order to select the customer name from the combo box and display all information of that customer name on the current form.

If you selected the customer name from the combo box, the record of the selected customer on the combo box will display on the current form without additional VB code.

When you add a button with a button wizard for adding a new record, the record on form will move to the new record which is ready for adding information and display an empty form. The customer ID field will display “(New)” for adding a new record.

The Form View of Unbound Form

When the unbound form is opened, there will be no data on the textboxes. If you want the customer information to display on this unbound form you will need to use the VB code to fill in these unbound textboxes on this form under the Form On Load or On Open event.

Add Combo Box

There are two options on the Combo Box Wizard when you try to insert the combo box on the unbound form as shown in the picture below. We need to select the 1st option of “I want the combo box to get the values from another table or query” in order to select the customer name from the combo box which has the data source from the customer table.

Insert Data to Unbound Form

 If you selected the customer name from the combo box, there will be no customer information filled in the textboxes corresponding to the label of the textboxes.

You will need to add VB code on AfterUpdate() Event procedure of the Customer Combo box (cboCustomer) to add the customer information to the textboxes, see code below.

 VB Code:

Private Sub cboCustomer_AfterUpdate()
Dim Criteria As String
Dim rs As Recordset
Dim db As Database

Set db = CurrentDb
Criteria = "Customer_ID = " & Me.cboCustomer & ""
Set rs = db.OpenRecordset("select * from [tbl customer] where " & Criteria)
If rs.RecordCount > 0 Then
   With rs
'insert data from tbl Customer table to corresponding textbox on Customer form
     Me.txtCustomerID = !Customer_ID
     Me.txtCustomerName = !CustomerName
     Me.txtAddress = !Address
     Me.txtCity = !City
     Me.txtState = !State
     Me.txtZip = !Zip
     Me.txtCustomer_Phone = !Customer_Phone
   End With
Else
   ' do nothing
End If
End Sub

 

Result after Selecting the Customer from the Combo box

All textbox fields are filled with the information corresponding to the customer that selected from the combo box by using the VBA and the RecordSet method.

Add New Data from Unbound Form to Table

The information you entered in the unbound form does not automatically save into the table because the textbox field is not linked to any field in the table. You must program to save it. You can use the RecordSet or SQL method to insert new data to the table. More information on my How To…

https://www.iaccessworld.com/use-sql-insert-into-statement/

Update Data from Unbound Form to Table

After the information was inserted to the unbound form (from the Insert Data to Unbound Form section above) you can update or change the data on form. However, the change that you make, without additional coding, does not save or update in the table. You can use the RecordSet or SQL method to save the change into the table. More information on my How To here…

https://www.iaccessworld.com/sql-update-statement/

Related posts