473,586 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I convert a working MS Access append (action) query to VBscript for ASP

2 New Member
I have a web programming task that has me stumped. I hope that one of you could give me some insight or might know someone who could guide me in the right direction. This is the final piece of the web application that my employer wanted finished by January 1st.

Perhaps my biggest problem is that I can’t seem to formulate the right search-engine search question to find the utility I need nor can I find any reference to the real issue. In short, I don’t know where to turn for help.

This is what I’ve got:

I have a MS Access 2003 append (action) query that reads data from three related tables and adds the data in rows to a fourth table. There are criteria-based relationship joins on each of the 3 original data tables. The purpose of the query is to insert as few as 3 or as many as 100 records in the StudentProgress table for each qualifying record in the VidStudents table. The query runs perfectly as expected when I click on it in Access. The tables and query are all combined in one Access application.

What I need:

The trouble is that the application runs on an ISS server running ASP. I, obviously, cannot click on the query to activate it, and I don’t know how to call it as a procedure (I gather from the documentation that calling it as a procedure is not possible.) I need something that will make it run on the server or do the same thing on the server that it does when it’s on my machine.

Here is the SQL query from Access:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO StudentProgress ( StudentID, StudentName, eMailAddr, TicketNo, Passwd, StartTime, CompletedTime, Status, CourseNum, CourseName, CourseShortName, NoOfSections, CourseSectionName, CourseSectionShortName, CourseSectionLength, VidFilename, VidName, SectionNum )
  2. SELECT VidStudents.StudentID, VidStudents.StudentName, VidStudents.eMailAddr, VidStudents.TicketNo, VidStudents.Passwd, VidStudents.StartTime, VidStudents.CompletedTime, IIf(CourseSections.InitialSection=Yes,"Ready","Not Ready") AS Status, Courses.CourseNum, Courses.CourseName, Courses.CourseShortName, Courses.NoOfSections, CourseSections.CourseSectionName, CourseSections.CourseSectionShortName, CourseSections.CourseSectionLength, CourseSections.VidFilename, CourseSections.VidName, CourseSections.SectionNum
  3. FROM VidStudents INNER JOIN (Courses INNER JOIN CourseSections ON Courses.CourseNum = CourseSections.CourseNum) ON VidStudents.CourseNum = CourseSections.CourseNum
  4. WHERE (((VidStudents.Setup)=No));
Most of the fields are text fields. The exceptions:

Date fields: StartTime, CompletedTime, and CourseSectionLe ngth
Integer fields: NoOfSections and SectionNum

The solution to this is probably extremely simple. I just don't know where to turn. Any guidance and all suggestions will be appreciated. Thanks!
Jan 16 '08 #1
2 2682
JamieHowarth0
533 Recognized Expert Contributor
Hi there,

Firstly, welcome to TSDN!

Secondly, calling your query as a procedure, contrary to popular belief, IS possible in MS Access (technically a "query" is a stored procedure)!

There are a couple of ways of connecting to and using SQL with a database in classic ASP - the most common one being the two-pronged connect-and-query approach (demonstrated here):
Expand|Select|Wrap|Line Numbers
  1. Set myconn = Server.CreateObject("ADODB.Connection")
  2. strconn="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/your_web_directory_to_your/database.mdb")
  3. myconn.open strconn
  4.  
  5. Set mycomm = Server.CreateObject("ADODB.Recordset")
  6. strSQL = "SELECT WhateverFields, * FROM YourTable WHERE Criteria = 'Whatever';"
  7. mycomm.open strSQL, myconn, 1, 1
  8.  
Now, to enable ASP to connect to and not just read, but update information within your database, you need to give the IUSR_MACHINE account read and write permissions on your database through IIS.

Then you can either attempt to replace your SQL code in the above bit of code, or, if you can't be bothered to copy and paste the SQL code in, use the same bit of code, but replace lines 5-7 with this:
Expand|Select|Wrap|Line Numbers
  1. Set mycomm = Server.CreateObject("ADODB.Command")
  2. mycomm.CommandText="name_of_your_query"
  3. mycomm.CommandType = adCmdStoredProc
  4. mycomm.Execute
  5.  
And that should run the query in your database!

Best regards,

medicineworker
Jan 16 '08 #2
TroutmansRegistrar
2 New Member
Thank you, medicineworker!

That worked perfectly! It was fast and simple. I used the first method and it worked. I may try the second method so that I can dynamically change the query if it becomes necessary.

Now I feel as if I know how to run a computer again. Of course, I am sure something will bite me, and I'll be crying again soon. In the meantime, I'll try to see if I can help someone out here as much as you have helped me.

Yours,
troutmansregist rar
Jan 16 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
17348
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures (update, append) should be activated in order to transfer data to other tables. I tried to avoid any coding in VB, as I am not a professional, but I...
5
5747
by: Zalek Bloom | last post by:
Hello, I am developing a simple ASP application with VBScript and Access database. I am testing it on my Win98SE machine using Personal Web Server. My machine is Celeron 2000 with 512Mb RAM. On the Access I have 2 tables, each one with less then 20 rows. The problem is, that each time my application access the database, the response is...
29
3687
by: Mark B | last post by:
We have an Access app (quite big) at www.orbisoft.com/download. We have had requests by potential users to have it converted to an SQL version for them since there corporate policy excludes them from buying mdb backends. Here's the (million dollar?) questions :) How long and how difficult a process would it be? Which SQL platform would...
1
3797
by: Cory | last post by:
When I run the subroutine testEmailContacts the msgbox says that there is only 1 record. The sql for qyEmailContactsQyCard is below. There is over 3000 records in the table "tbl:Contact". What am i doing wrong? Thanks in advance. PARAMETERS cardYesNo Bit, ParSearchCard Bit; SELECT .ContactID FROM WHERE (((.Card)=)) OR ((()=No));
1
2531
by: Bob Gardner | last post by:
I started to develop an application in Access 97 but have been finishing it up in A2K. The code that I used in the 97 version worked fine but I get a runtime 2486 error now in the 2000 version using the same code. It appears to me that running the append query is what causes the problem. I don't have a problem running the update query. ...
13
4219
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a solution here - until now. This one is driving me crazy. I am making my first attempt at creating a runtime application. I am using Access 2003...
7
2863
by: Dean | last post by:
This seems like it should be easy but I am stumped. I am trying take a variable, add to it, and insert the result as a new record into Access. The ending result is: INSERT INTO Period (CoID, CkDate) Values 1, #2007/01/26#)
3
19918
by: clarencemo | last post by:
Hello all, I have a append query that works great if I just run the query via Access. I need to convert that query into VBA code. Here is the SQL View of the query I'm trying to convert: INSERT INTO TblInitiator IN 'X:\Archive\TestFinal\080107\TS3000v101_be.mdb' SELECT tblAddInitiator.* FROM tblAddInitiator;
13
3712
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between !! And !! Not sure how to do so (should it be a query in Access or a macro) The connection would be ODBC.
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.