CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Custom Error Message After Jet Database Error

Print topic Send  topic

Author Message
rho


Posts: 85
Posted: 04/27/2005, 2:25 AM

Hi all,

in an Editable Grid, when I delete a record using the Delete checkmark, I get an error message like 'The record cannot be deleted or changed because table 'tblMaster' includes related records. (Microsoft JET Database Engine', because the table tblMaster has referential integrity to tblDetail.

Question: what would be - in the case of an Editable Grid - the approach to customize or prevent the error message text and change it to a more descriptive non-Jet error message? Or more general: how do I catch the Jet error messages?

Thanks for any pointers!
View profile  Send private message
Nicole

Posts: 586
Posted: 04/27/2005, 5:16 AM

Hello,
You can create onValidate event where check using CCDLookUp() function if certain record has related records in other table. If yes, then add custom error message to form or field Errors collection.

_________________
Regards,
Nicole
View profile  Send private message
rho


Posts: 85
Posted: 04/27/2005, 7:11 AM

Thanks for your quick reply. But if a user wants to *delete* a row in the editable grid, how do I know which row is going to be deleted, so I can do my CCDLookup()?
View profile  Send private message
Nicole

Posts: 586
Posted: 04/27/2005, 9:04 AM

Try to check a value of CheckBox_Delete control. It should return "true" (i.e. value specified in its Checked Value property) for records which are selected for delete.
_________________
Regards,
Nicole
View profile  Send private message
rho


Posts: 85
Posted: 04/27/2005, 11:42 PM

Thanks Nicole. I didn't know that. Learning every day! However - now I am able to detect the row where a record is to be deleted using Checkbox_Delete.checkedvalue - I now run into the following:

My Editable Grid tblSector looks like this (I try to delete sector_1):

SECTOR DELETE
sector_1 X
sector_2
sector_3

I am using the following OnValidate event (simplified to show my point):

Function tblSector_OnValidate()
if tblSector.Checkbox_Delete.checkedvalue then
tblSector.Errors.AddError "You cannot delete sector " & tblSector.Sector.value
end if
End Function

Given the Editable Grid above, I would expect the OnValidate() to return:
'You cannot delete sector sector_1', but the function returns 'You cannot delete sector sector_3' instead. Obviously, this doesn't seem right.

Any ideas?
View profile  Send private message
Nicole

Posts: 586
Posted: 04/28/2005, 2:51 AM

Form’s onValidate event is fired only once, but you need to run the validation code for every row. So create field’s onValidate event that is executed for each row. And of course assign error message to field Errors collection
_________________
Regards,
Nicole
View profile  Send private message
rho


Posts: 85
Posted: 04/28/2005, 5:57 AM

I am now using the OnValidate() for the Sector-field in the row (function tblSector_Sector_OnValidate()), as you suggested, but it doesn't work in my case: apparently the field's OnValidate() isn't executed by CCS when *deleting* a row.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.