|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
print your SQL line before executing, perhaps your variable is blank.
|
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > vbscript mdb problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|