iclydesdale
Posts: 3
|
| Posted: 01/12/2005, 5:16 AM |
|
Hi,
I am sure this is an easy problem to resolve (if you know how), I have a record form that I want to use to insert new values in a table but I want to check for the existance of records with similar values and abort the insert if they exist basically I have my validation process but I don't know how to stop the insert event from completing.
My guess is I need to put something in Before Insert but am not sure.
Any assistance would be greatly appreciated.
Regards
Ian
|
 |
 |
Ozum
Posts: 57
|
| Posted: 01/12/2005, 8:33 AM |
|
I use Perl, so my explanation is in Perl syntax but the method is general.
There are 3 methods, the first one uses internal mechanism of CCS 2nd and 3rd method allows you use your own methods:
1. Click the form control and in properties window change to data tab. Set uniqe method to Yes to disallow same value to be inserted in database.
2. Again in data tab, use Validation Rule property. This property expects a boolean value. If your code or function returns false it stops the insert process and prints what you type in Validation Text property.
3. In the events add an 'On Validate' event to the form. Make your check and if there is an error use (for Perl)
$form_name->{ControlName}->Errors->addError('There is a mistake in the form')
This stops the insert process too.
P.S. In help file there is an example for ASP under the title 'Errors Run-Time ASP', but I can't check it out, since I don't use ASP
OrderForm.Errors.AddError "This order cannot be processed. Please fix it."
|
 |
 |
DonB
|
| Posted: 01/12/2005, 8:50 AM |
|
Look at the AllowInsert, AllowUpdate and AllowDelete properties of the
grid/record control. Set them false in the corresponding "Before" event to
prevent them from completing the action.
--
DonB
http://www.gotodon.com/ccbth
"iclydesdale" <iclydesdale@forum.codecharge> wrote in message
news:241e52347b2c73@news.codecharge.com...
> Hi,
> I am sure this is an easy problem to resolve (if you know how), I have a
record
> form that I want to use to insert new values in a table but I want to
check for
> the existance of records with similar values and abort the insert if they
exist
> basically I have my validation process but I don't know how to stop the
insert
> event from completing.
>
> My guess is I need to put something in Before Insert but am not sure.
>
> Any assistance would be greatly appreciated.
> Regards
> Ian
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
iclydesdale
Posts: 3
|
| Posted: 01/12/2005, 10:43 AM |
|
Many thanks for the responses, I have not resolved the issue, much appreciated.
Ian
|
 |
 |
|