I
Iona
okay.. this should be long..
I made up a table in database with access consists of columns with text type. Some of them I put in data with numeric value and some of them I put in "Unlimited" as the value.
Then, I allowed people to insert data but only with conditions. They can insert data if the value they are trying to insert is smaller than the one in the database. For "unlimited" value, they can insert any value.
My problem is.... if the limited value in the database is 35, we cant insert data of 40 but we can insert data of 100. It seems that the code only takes the first number to be compared to the value in the database.
Can anyone help me to overcome this?
here''s part of my code
If (diff = 0) OR (diff = 1) Then
If (maxunit1 < strnoofunit) OR (maxdoc1 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 2) Then
If (maxunit2 < strnoofunit) OR (maxdoc2 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 3) Then
If (maxunit3 < strnoofunit) OR (maxdoc3 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End if
ElseIf (diff = 4) Then
If (maxunit4 < strnoofunit) OR (maxdoc4 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 5) Then
If (maxunit5 < strnoofunit) OR (maxdoc5 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
Else
If (maxunit6 < strnoofunit) OR (maxdoc6 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
End If
'' -------------------------------------------------------------------------
'' finish
'' -------------------------------------------------------------------------
rs.Open "SELECT * FROM timesheet", conn, 3, 3
''Add a record
rs.AddNew
''Put username and password in record
rs("memberid") = Session("memberid")
rs("reference_no") = strrefno
rs("entry_date") = date()
rs("lspid") = Session("lspid")
rs("solicitorid") = Session("solid")
rs("code") = strcode
rs("no_of_unit") = strnoofunit
rs("no_of_document") = strnoofdoc
rs("note_legalmatter")= strlegalmatter
rs("note_entitlement")= strentitle
''Save record
rs.Update
Thanks guys
I made up a table in database with access consists of columns with text type. Some of them I put in data with numeric value and some of them I put in "Unlimited" as the value.
Then, I allowed people to insert data but only with conditions. They can insert data if the value they are trying to insert is smaller than the one in the database. For "unlimited" value, they can insert any value.
My problem is.... if the limited value in the database is 35, we cant insert data of 40 but we can insert data of 100. It seems that the code only takes the first number to be compared to the value in the database.
Can anyone help me to overcome this?
here''s part of my code
If (diff = 0) OR (diff = 1) Then
If (maxunit1 < strnoofunit) OR (maxdoc1 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 2) Then
If (maxunit2 < strnoofunit) OR (maxdoc2 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 3) Then
If (maxunit3 < strnoofunit) OR (maxdoc3 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End if
ElseIf (diff = 4) Then
If (maxunit4 < strnoofunit) OR (maxdoc4 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
ElseIf (diff = 5) Then
If (maxunit5 < strnoofunit) OR (maxdoc5 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
Else
If (maxunit6 < strnoofunit) OR (maxdoc6 < strnoofdoc) Then
rs2.close
conn.close
set rs2 = nothing
set conn = nothing
Server.Transfer("maxunit2.asp")
End If
End If
'' -------------------------------------------------------------------------
'' finish
'' -------------------------------------------------------------------------
rs.Open "SELECT * FROM timesheet", conn, 3, 3
''Add a record
rs.AddNew
''Put username and password in record
rs("memberid") = Session("memberid")
rs("reference_no") = strrefno
rs("entry_date") = date()
rs("lspid") = Session("lspid")
rs("solicitorid") = Session("solid")
rs("code") = strcode
rs("no_of_unit") = strnoofunit
rs("no_of_document") = strnoofdoc
rs("note_legalmatter")= strlegalmatter
rs("note_entitlement")= strentitle
''Save record
rs.Update
Thanks guys