I have a inventory detail table that I receive in the equipment. I also have a equipment in stock table that is for viewing only. When I bring in a piece of equipment, I am auto generating a Tag ID number. Using this function below, all of the information is transfering except the tag id. It seems to me that the reason that the Tag ID is not transfering is that the ID has not been created until after the entry is posted and I am posting to the equipment table before the post. I have tried to add after with the same code but I am getting a value error. Do I need to use a different format to get the values? I have inserted the code that I am using for the before add.
function BeforeAdd(&$values)
{
// Parameters:
// $values - Array object.
// Each field on the Add form represented as 'Field name'-'Field value' pair
//** Insert a record into another table ****
global $conn;
$strSQLInsert = "insert into _equipment_in_stock (Tag_ID, Customer, Salesman, Location_No, Part_No, Model_No, Serial_No, Color, Size, Description) values (
'".$values['Tag_ID']."',
'".$values['Customer']."',
'".$values['Salesman']."',
'".$values['Location_No']."',
'".$values['Part_No']."',
'".$values['Model_No']."',
'".$values['Serial_No']."',
'".$values['Color']."',
'".$values['Size']."',
'".$values['Description']."'
)";
db_exec($strSQLInsert,$conn);
return true;
// return true if you like to proceed with adding new record
// return false in other case
}