Adding a record to a database


I'm new to asp and vbscript and am stuck -

I have created a page with a form on it and used a vbscript function to validate the form..

My problem is this..

Once the form is validated i want to add the form content to an access database.. I only want the connection to be made when the submit button is clicked and the fields checked to limit the connection times as I know there is a limit on concurrent connections using access..

how do i put the asp code into the vbscript so it works if the validation is successful -

the code i have used is:


Customer Service Questionnaire - Registration Page

Function frmLogin_OnSubmit
Validation = true

If Document.frmLogin.txtFirstname.Value = "" then
msgbox "Please enter your First Name",vbexclamation+vbokonly,"Input Error"
Validation = false
ElseIf Document.frmLogin.txtsurname.Value = "" then
msgbox "Please enter your Surname",vbexclamation+vbokonly,"Input Error"
Validation = false
ElseIf Document.frmLogin.cbogender.Value = "x" then
msgbox "Please select gender from the list",vbexclamation+vbokonly,"Input Error"
Validation = false
ElseIf Document.frmLogin.Txtemail.value = "" then
msgbox "Please enter your Email Address",vbexclamation+vbokonly,"Input Error"
Validation = false
ElseIf Document.frmLogin.TxtCompany.value = "" then
msgbox "Please enter your Company",vbexclamation+vbokonly,"Input Error"
Validation = false
ElseIf Document.frmLogin.TxtDepartment.value = "" then
msgbox "Please enter your Department or Section",vbexclamation+vbokonly,"Input Error"
Validation = false
End If

frmLogin_OnSubmit = Validation
End Function



Please complete the following registration form.

All details will be treated confidentially.

First Name:

Please Select
Email Address:

Any help would be apppreciated
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!