Results 1 to 2 of 2
  1. #1
    JayW is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Posts
    3

    Access not accepting Insert Into data from webpage

    Hi all, thank you for taking the time to try and help me with a problem I'm having.



    I have written a html page that posts a form to a .asp page, which in turn is supposed to write data to a MS Access database. Problem is while my html page works, and my .asp page seems to work fine as well, nothing is being saved to my database!

    I'm not sure if its something wrong in my .asp page...

    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <% Option Explicit %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Submit Hours</title>
    </head>
    
    
    <body>
    
    
        <%
        
            Dim num, employee, dept, branch, org, hours, mnth, yr
            Dim MyConn, SQL_query
            
            num = Request.Form("number")
            employee = Request.Form("name")
            dept = Request.Form("dept")
            branch = Request.Form("branch")
            org = Request.Form("org")
            hours = CInt(Request.Form("hours"))
            mnth = Request.Form("month")
            yr = Request.Form("year")
        
            Set MyConn = Server.CreateObject("ADODB.Connection") 
        
            MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\inetpub\wwwroot\human_resources\volunteerhours\volunteerhours.mdb; "
        
            SQL_query = "INSERT INTO VolunteerHours ([Clock#], Employee, Department, Branch, Organization, Hours, [Month], [Year])" & _
            "VALUES ('" & num & _
            "','" & employee & _
            "','" & dept & _
            "','" & branch & _
            "','" & org & _
            "'," & hours & _
            ",'" & mnth & _
            "','" & yr & _
             "')"
        
            MyConn.Execute(SQL_query)
            
            response.write "The form information was inserted successfully."
            response.write num
        
            MyConn.close
            set MyConn = nothing
            
        %>
    </body>
    </html>
    or if you think there may be some configuration in my database I'm missing. Just an FYI all the database table columns take empty values.

    Thanks for the help!!!

  2. #2
    JayW is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Posts
    3
    By the way, I've confirmed my connection works by querying the table. I've also confirmed the insert into statement works directly inside MS Access.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. INSERT query: insert new data only
    By drh in forum Access
    Replies: 2
    Last Post: 04-04-2014, 05:31 PM
  2. Make Table Query not accepting new records?
    By access allowed in forum Queries
    Replies: 5
    Last Post: 11-08-2011, 07:29 PM
  3. Replies: 1
    Last Post: 04-01-2011, 01:28 PM
  4. New Computer not accepting 5 digits
    By abie059 in forum Database Design
    Replies: 3
    Last Post: 01-10-2011, 10:02 PM
  5. Exporting Form in Access to Webpage
    By StarrySky in forum Forms
    Replies: 0
    Last Post: 03-14-2010, 11:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums