Hi,
I have been using the following code to generate an autonumber field for various forms, just changing the values as required depending on what I have named them in the forms (e.g. intClientID, intContactID, intVenueID, etc.)
I would like to get rid of the spaghetti code, and simply call a function, but am having issues. The form where I store the values is called frmMaxValue, and it has several different integer fields (e.g. intClientVal, intContactVal, etc.)
- varMaxValue = frmMaxValue [ID != 0];
input.intClientID = (varMaxValue.intClientVal + 1);
varMaxValue.intClientVal = (varMaxValue.intClientVal + 1);
I tried the following code:
But I keep getting the following error message: Error at line: 3 Form varFormName does not exist in this application
- void basMaxValue(string varFormName, int intMaxValue, int intPrimaryKey)
{
varMaxValue = varFormName [ID != 0];
input.intPrimaryKey = (varMaxValue.intMaxValue + 1);
varMaxValue.intMaxValue = (varMaxValue.intMaxValue + 1);
}
I tried it without delcaring varFormName and just using the actual form name, but got the same error.
Any direction I should be going with this?
Thanks
Leo Saumure