Pages

Tuesday, December 27, 2011

Create a new field or column Using Query

If you want to add the new field or column in the table.

Here is the code-

Sub add_new_field_in_table_using_query()
DoCmd.SetWarnings (False)
On Error Resume Next
' CLOSE THE TABLE IF ITS OPEN
DoCmd.Close acTable, "SALES_DETAIL", acSaveYes
'add a new field name S_No and data type Long
DoCmd.RunSQL "ALTER tABLE SALES_DETAIL ADD S_NO long"
DoCmd.SetWarnings (True)
End Sub

Download Access Database

No comments:

Post a Comment