ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 30th, 2003, 02:47 PM
jwildman jwildman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 jwildman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
vbscript mdb problem

I have the following vbscript;

Dim MyConn, SQL, RS
Set MyConn=CreateObject("ADODB.Connection")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\6180\6180.mdb;"
Today = now() - 30
TblName = Month(now) & Day(now) & Year(now)
Set RS=CreateObject("ADODB.Recordset")
SQL = "SELECT DISTINCTROW * INTO " & TblName
SQL = SQL & " FROM Requests INNER JOIN AuditTable ON Requests.Jobno = AuditTable.JobNum "
SQL = SQL & "WHERE (((AuditTable.DateTime)< '" &Today& "'));"
MyConn.Execute(SQL)
SQL = "DELETE * FROM Requests WHERE Jobno in (select jobno from "& TblName &" where Requests.[JobNo] = ["& TblName &"].[Jobno]);"
MyConn.Execute(SQL)
SQL = "DELETE * FROM AuditTable WHERE AuditTable.[JobNum] = ["& TblName & "].[Jobno];"
MyConn.Execute(SQL)
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing

all but the last bit of sql works fine.. there i get a "too few parameters" error.
However pasting the sql into access works perfectly..

Whats up with that?
Jim Wildman

Reply With Quote
  #2  
Old October 2nd, 2003, 08:58 AM
drgroove's Avatar
drgroove drgroove is offline
pushing envelopes, not pencils
Dev Shed God 2nd Plane (6000 - 6499 posts)
 
Join Date: Feb 2002
Posts: 6,224 drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level)drgroove User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Day 4 h 34 m 57 sec
Reputation Power: 174
Moved to the ASP forum
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever.
Analyze twice; hack once.
The world's first existential ITIL question: If a change is released into production without a ticket to track it,
was it actually released?


About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect -
Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire


Reply With Quote
  #3  
Old October 2nd, 2003, 10:16 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
print your SQL line before executing, perhaps your variable is blank.

Reply With Quote
  #4  
Old October 3rd, 2003, 07:55 AM
jwildman jwildman is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 jwildman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Tried that! here is what got it working for me..

SQL = "DELETE * FROM AuditTable Where JobNum in (SELECT DISTINCTROW JobNum FROM AuditTable LEFT JOIN Requests ON AuditTable.[JobNum] = Requests.[Jobno] WHERE (Requests.[Jobno]) Is Null);"

It was just plain old bad sql that caused my problem.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > vbscript mdb problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway