[ Team LiB ] |
Recipe 16.5 Create a Smart Tag on a Table in an Access Project16.5.1 ProblemI would like to create a smart tag on a table in my Access Project (.adp). When I open the SQL Server table in the table designer in my Access project, I do not see the smart tag property, although it is listed for controls in the Forms designer. 16.5.2 SolutionIn SQL Server, the smart tag property has to be set as an extended property since it is not one of the standard SQL Server table properties. This requires that you run SQL Server's built-in sp_addextendedproperty system stored procedure to add it as an extended property. The syntax shown in SQL Server Books Online for sp_addextendedproperty is not that easy to figure out, as you can see from this listing: sp_addextendedproperty [ @name = ] { 'property_name' } [ , [ @value = ] { 'value' } [ , [ @level0type = ] { 'level0_object_type' } , [ @level0name = ] { 'level0_object_name' } [ , [ @level1type = ] { 'level1_object_type' } , [ @level1name = ] { 'level1_object_name' } [ , [ @level2type = ] { 'level2_object_type' } , [ @level2name = ] { 'level2_object_name' } ] ] ] ] Follow these steps to add the PersonName smart tag to the LastName column in the Employees table in the NorthwindCS SQL Server database:
16.5.3 DiscussionIn order to execute sp_addextendedproperty, the minimum permissions required are membership in the db_owner and db_ddladmin fixed database roles. The code listing here assumes that you are running it as a system administrator (the dbo user). Unlike creating a smart tag in an Access/Jet database, there is no way to propagate the new extended property to any previously existing forms automatically. However, new forms that you create on the Employees table will inherit the new Person Name smart tag set on the LastName column. You can test to see if the code executed correctly by creating a new AutoForm on the Employees table, as shown in Figure 16-7. Figure 16-7. A new form created after running sp_addextendedproperty inherits the smart tag extended property
16.5.4 See AlsoFor more information on working with extended properties in SQL Server, see the SQL Server help topic, "Using Extended Properties on Database Objects." |
[ Team LiB ] |