Populating an Access form is a simple task thanks to bound forms and controls. In fact, a wizard will walk you through the whole setup. There are a number of ways to add a search feature, but a text box or a combo box in the header is one of the simplest to create and implement. A primary key value might be your first choice. Once you know how users will want to search the data, you can create and implement a search solution. For example, the following instructions add a search control to the Orders form in Northwind, the demo database that comes with Access : With the Orders form in Design view, open the header and insert an unbound text box control.
Name the text box txtSearch. So my design approach for a search form needs to follow these main principles:. In a new database, I import the form and adapt it accordingly.
This is a simple adaptation:. The template form has tabs for searches collected from many databases. A datasheet is a simple way to look at your data in rows and columns without any special formatting. Whenever you create a new web table, Access automatically creates two views that you can start using immediately for data entry. A table open in Datasheet View resembles an Excel worksheet, and you can type or paste data into one or more fields.
You do not need to explicitly save your data. Access commits your changes to the table when you move the cursor to a new field in the same row, or when you move the cursor to another row. As you can see, like forms and reports, Data Access Pagescan be generated in either Design View or by using the wizard.
Figure The Pages window. The first screen should be familiar to anyone who has built a form or report using the wizard. As shown in Figure , it allows you to select the table or query that the page will be attached to, and the fields you want to use.
Figure First step in the Page Wizard. As you can see, our web page is based on all the fields in tblCustomer. Once that is done, select Next. You should see a screen similar to Figure Figure Step 2 of the Page Wizard. This allows you to decide if you want to group the data together in any particular way. That concept is discussed in Chapter 13 about reports.
For this example, we are not going to use a grouping. Instead, just click on Next, which produces the screen shown in Figure Figure Step 3 of the Page Wizard. In this screen you decide how you want the data sorted. If the page is already associated with a query, that may be decided already. However, since our example is based on a table, we are going to sort it on the txtCustFirstName and txtCustLastName fields.
The proper SQL code string will be written in the background. After clicking Next, you are brought to the screen shown in Figure This last screen allows you to name the Data Access Page. We will be discussing naming more in a bit. However, for the time being, you should use the identifying prefix of dap. In this example, the Open the Page option is also selected.
Figure Final step of the Page Wizard. Once all is completed, click on Finish and you should see a page similar to the one shown in Figure Figure A Data Access Page. There are two interesting things going on here. First of all, you see the fields much like you would on any other form. But what is unique is that Access created a web-based navigation bar that, like a regular form, allows you to move through the records, change the sort, filter records, and so on.
In other words, it is like any normal form you work with—the only difference being that it is web based. Remember, this form is built using HTML. You will see something like Figure Figure The Microsoft Script Editor.
0コメント