AddStock() generate/enh73.jpg


Adds a stock record to the stock database.

Syntax

AddStock(<cName>, [<cLocation>], <cDescription>, <cGroup>) --> nResult

Arguments

<cName> --> This must be a non-blank product code/product name. A stock item with this product code/name must not already exist in the system.

<cLocation> --> The stock location. This is a code up to 8 characters wide. The stock location must be specified if multi-location stock control is activated. If multi-location stock control is active, a stock record cannot be added to the stock database unless both the product code combined with a product location are unique. The same product code may be assigned to the stock database so long as the specified location is different in each case.

<cDescription> --> The optional production description. The product description may be of any length.

<cGroup> --> The stock group code. This is a code up to 8 characters wide.

generate/notepad1.gifWhen the Unique Stock Tracing Component is installed, and the stock group has been assigned tracing properties, then passing the stock group code to this function will cause these tracing properties to be assigned to this product also.

Returns

Return Value of nResult

Meaning

0

Operation was completed successfully.

-1

The operation failed. (General failure.) An error message will be displayed describing the reason for the failure, such as an invalid parameter passed to the function.

-2

The stock item could not be added to the stock database because the item already exists. This condition does not result in the display of an error message.

If 0 is returned, the stock database is left positioned on the newly created record. Otherwise, the original stock record position is restored.

Description

This function adds a stock record to the CAPITAL stock database. The function assumes that the STOCK database and TYPE (stock group) databases are already open and available. If it is not, use the OpenTable() function to open them first. If the operation is successful, the record is locked, ready for writing further information to it. You do not need to use the LockRecord() function. However, if you want other users to be able to access the record right away, you should issue:

Stock->(UnlockRecord())

after you have finished updating it.

____________________________

Related Topics:

Business Function List

AddTraceProperty()



CAPITAL VISUAL BUILDER