Database Reference
In-Depth Information
After creating the view, you can use it right away. Figure 4-4 shows the data in the Housewares view. You
can create a form for the view, base a report on the view, and treat the view as though it were a table.
123
Data in view
FIGURE 4-4
Housewares view datasheet
What if Juan wanted different names for the fields? You can use SQL to change the field names in a view
by including the new field names in the CREATE VIEW command. For example, if Juan wanted the names of
the PartNum, Description, OnHand, and Price fields to be PNum, PDesc, OnHd, and Price, respectively, the
CREATE VIEW command would be as follows:
CREATE VIEW Housewares (PNum, PDesc, OnHd, Price) AS
SELECT PartNum, Description, OnHand, Price
FROM Part
WHERE Class= ' HW '
;
Now when Juan accesses the Housewares view, he uses the field names PNum, PDesc, OnHd, and Price
rather than PartNum, Description, OnHand, and Price, respectively.
In Access, you can change the field names by preceding the name of the field with the desired name,
followed by a colon, as shown in Figure 4-5.
View name
New field
names
Fields
FIGURE 4-5
Access query design of the Housewares view with changed field names
Search WWH ::




Custom Search