Originally Posted by
dglienna
Separate the logic, and test!
Code:
Dim Flag as Boolean
Flag=FALSE
Dim Test as String
If Test = Trim("TypeName")="" Then Flag=TRUE
If Flag = TRUE then
' Add record only if true
End If
Hi There..... I've tried to do as you suggested but all l get is a blank webpage with error 500. I've copied the code below to see if you think I have made any errors ???
Code:
<%
' *** Insert new category, name and link color to the database but allows it me to enter a blank field which it shouldn't ??:
Dim CategoryRS
Set CategoryRS = Server.CreateObject("ADODB.Recordset")
CategoryRS.Open "SELECT * FROM Type", Connect, 2, 3
If Not Trim("TypeName")=""Then
'Else
' Response.write ("You Have Not Entered A Valid Category Name")
'End If
'Dim Flag as Boolean
'Flag=FALSE
'Dim Test as String
'If Test = Trim("TypeName")="" Then Flag=TRUE
'If Flag = TRUE then
' Add record only if true
CategoryRS.Addnew
CategoryRS("TypeName").Value=Request("TypeName")
CategoryRS.Update
End If
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align="left" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center" valign="middle"><p class="textEvent"> </p>
<p class="textEvent">The category "
<% Response.Write Request("TypeName")
%>
" has been added to the database.</p>
<p class="textEvent"> </p>
all suggestions and help gratefully accepted..... Regards