Advertisement

02.14.2007 at 12:45PM PST, ID: 22389728
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Check another table for record before delete - asp

Tags: asp, check, table, another, delete
Hi,
I have a table called 'age group'. with 2 fields:
agegroup_id
agegroup_desc

I have another table called 'client' with many fields, one of which is called:
agegroup_id
The field 'agegroup_id' is a combo box which options are lookedup from the 'age group' table.

Now what I want to do is to prevent the Administrator from deleting records from the 'age group' table if the record ('agegroup_id' value) has been used in the 'client' table.

I figure I need to check the 'client' table existing records to see if the particular 'agegroup_id' has been selected but I am not sure how to incorporate this with the current Delete function (seen below).

Please could someone help me?  Thank you.

'-------------------------------------------------------------------------------
' Function DeleteData
' - Delete Records based on input sql criteria sqlKey

Function DeleteData(sqlKey)
      On Error Resume Next
      Dim rs, sSql, sFilter
      Dim rsold
      sFilter = sqlKey
      sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "")
      Set rs = Server.CreateObject("ADODB.Recordset")
      rs.CursorLocation = 2
      rs.Open sSql, conn, 1, 2
      If Err.Number <> 0 Then
            Session(ewSessionMessage) = Err.Description
            rs.Close
            Set rs = Nothing
            DeleteData = False
            Exit Function
      End If

      ' Clone old rs object
      Set rsold = CloneRs(rs)

      ' Call recordset deleting event
      DeleteData = Recordset_Deleting(rs)
      If DeleteData Then
            Do While Not rs.Eof
                  rs.Delete
                  If Err.Number <> 0 Then
                        Session(ewSessionMessage) = Err.Description
                        DeleteData = False
                        Exit Do
                  End If
                  rs.MoveNext
            Loop
      End If
      rs.Close
      Set rs = Nothing

      ' Call recordset deleted event
      If DeleteData Then
            Call Recordset_Deleted(rsold)
      End If
      rsold.Close
      Set rsold = Nothing
End Function

'-------------------------------------------------------------------------------
' Recordset deleting event

Function Recordset_Deleting(rsold)
      On Error Resume Next

      ' Please enter your customized codes here
      Recordset_Deleting = True
End Function

'-------------------------------------------------------------------------------
' Recordset deleted event

Sub Recordset_Deleted(rsold)
      On Error Resume Next
      Dim table
      table = "age group"
End Sub
%>
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: bagni99
Solution Provided By: fritz_the_blank
Participating Experts: 2
Solution Grade: A
Views: 4
Translate:
Loading Advertisement...
02.14.2007 at 01:21PM PST, ID: 18535601

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.15.2007 at 09:40AM PST, ID: 18542184

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.15.2007 at 01:55PM PST, ID: 18544325

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.14.2007 at 08:09AM PDT, ID: 19487139

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.14.2007 at 08:59AM PDT, ID: 19487265

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.21.2007 at 07:22AM PDT, ID: 19539190

Rank: Sage

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.28.2007 at 08:06PM PDT, ID: 19586887

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29