VBScript Access query problem

Author Message
jbenedick
  • Total Posts : 1
  • Scores: 0
  • Reward points : 15440
  • Joined: 9/24/2007
VBScript Access query problem - Wednesday, December 07, 2011 4:10 PM
0
I'm trying to have a VBscript query an I have and copy the entries that have a 4 digit ProdID (there are ProdIDs with letters I'm looking for the ones with only 4 digits) into a new table. My query works perfect from inside of Access but when I take it and move it to a VBscript I get a blank table (it creates the TEMP table but it is empty. I believe the problem is with my WHERE statement. If I remove the WHERE statement from the VBscript it copies all of the entries from the TestDB table to the TEMP table. I'm running this script on a Windows XP Professional with Office 2010 Professional Plus. Here is my code:

DIM objConn, SQL1
Set objConn=CreateObject("ADODB.Connection")
objConn.Open "Provider=.ACE.OLEDB.12.0;" & _
"= TestDB.accdb"
SQL1 = "SELECT * INTO TEMP " &_
    "FROM TestDB " &_
    "WHERE (TestDB.ProdID Like '####');"
ObjConn.Execute SQL1
ObjConn.close
set ObjConn = nothing

Thanks!

gjones
  • Total Posts : 2291
  • Scores: 136
  • Reward points : 97970
  • Joined: 6/5/2001
  • Location: Ottawa, Ontario, Canada
Re:VBScript Access query problem - Sunday, July 01, 2012 11:06 AM
0
Yes, I know this is an old post, I’m trying to clean up older posts that are unanswered.
Did you ever figure this out?