Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Query error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sanju - 25 Apr 2008 06:58 GMT
Hai,to every one

here is my question

I have designed the coding to collect the feedback report from the user
,which includes Name of the user, staffno and comments.But when I click on
submit button I am getting the following error

 Error type :
       Microsoft Jet Database Engine (0*80040E14)
       Number of query values and the desatination feilds are not the same
        /report/formreport.asp,Line 2
---------------------------------------------------------------------------------------------------------------------------------------------------------
The coding is shown below

<html>
<% @LANGUAGE="VBScript" %>
     <body>
             <%
                   ' Declaring variables
                    Dim username, userstaffno, usercomments, data_source,
con, sql_insert

                   ' A Function to check if some field entered by user is
empty
                     Function ChkString(string)
                     If string = "" Then string = " "
                     ChkString = Replace(string, "'", "''")
                     End Function

                    ' Receiving values from Form
                     username = ChkString(Request.Form("username"))
                     userstaffno = ChkString(Request.Form("userstaffno"))
                     usercomments = ChkString(Request.Form("usercomments"))

             
                     data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=" &_
                      Server.MapPath("formreport.mdb")

                      sql_insert = "insert into formreport
(username,userstaffno,usercomments)"
                      sql_insert = sql_insert & " values (' " &  
Request.Form("username") & " ' , ' " & Request.Form("userstaffno") & " ' , '
" &  Request.Form("usercomments") & " ' , ' " & " ' )"  
       
                    ' Creating Connection Object and opening the database
                      Set con = Server.CreateObject("ADODB.Connection")
                      con.Open data_source
                      con.Execute sql_insert
                     
                    ' Done. Close the connection
                      con.Close
                      Set con = Nothing
                      Set sql_insert = Nothing
                      Response.Write "All records were successfully entered
into the database."
                %>
    </body>
</html>

Can any one please help me
Thanks in advance
Brendan Reynolds - 25 Apr 2008 10:03 GMT
Looks like you have one too many commas in there ...

> " &  Request.Form("usercomments") & " ' , ' " & " ' )"   <-- extra comma
> after last value

Signature

Brendan Reynolds

> Hai,to every one
>
[quoted text clipped - 61 lines]
> Can any one please help me
> Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.