confirm db submit is accepted

M

MaureenKLM

FP 2002 w/ Access DB

I have an online registration process which requires visitor to create a UID
and PSWD - this gets submitted to an Access DB. Visitors must logon using
the UID & PSWD to view certain pages....mostly all works except I need to
check/respond if the initial registration of the UID & PSWD are accepted into
the Access DB -

Reasons for unacceptance include invalid field data and duplication of entry
in the db.

Please provide article reference or code to assist me. THANKS!
 
K

Kevin Spencer

Hi Maureen,

Okay, you have 2 issues:

1. Invalid Field data: This can be controlled by client-side JavaScript
validation. Don't allow the person to input erroneous data.
2. Duplicate entry: The most efficient way to handle this is by a
combination of database and code. In the database, you don't allow duplicate
records. In your code, you use an "on error resume next" statement to
suppress errors. Then you attempt to insert the record. Afterwards, you
check the Error object, specifically, the Error.Number property. If it is
not 0, the database operation failed (due to your database constraints). If
the database operation failed, you want to re-send the form and some kind of
message indicating that this was a duplicate record.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
M

MaureenKLM

Thanks Kevin -
Issue 1 is taken care of in the form itself.

Issue 2 is where I need help. I need to do exactly what you outline - is
there sample code to do this somewhere?
 
K

Kevin Spencer

Well, I'm kind of reluctant to write code for people (teach a man to
fish...), but I'll give you some hints:

<%
On Error Resume Next
' Your code to insert into the database here
If Error.Number = 0 Then
' Code to display page with successful results
Else
'Code to display page with form and error message
End If
%>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
M

MaureenKLM

Thank You for your guidance.

Kevin Spencer said:
Well, I'm kind of reluctant to write code for people (teach a man to
fish...), but I'll give you some hints:

<%
On Error Resume Next
' Your code to insert into the database here
If Error.Number = 0 Then
' Code to display page with successful results
Else
'Code to display page with form and error message
End If
%>

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top