View Full Version : Yet another Access to MSSQL ?


mrgreen
04-22-2008, 01:45 PM
I have a couple tables in MSAccess 2003 and I'm trying to send the information to MSSQL 2005. I keep getting an alarm saying "Invalid object name tbllocal scrap has occurred. Is this because tbllocalscrap exists in MSAccess and not in MSSQL

Here is my code. I'm fairly new to this stuff so any help would be greatly appreciated.

strSQL = "INSERT INTO tblmainscreenscrap([Incr],[Date entered],[Time entered],[Name],[Shift],"
strSQL = strSQL + "[Area],[Part Number],[WO Number],[Category],[Reason],"
strSQL = strSQL + "[Qty],[Comments])"
strSQL = strSQL + " SELECT "
strSQL = strSQL + "tbllocalscrap.[Incr],"
strSQL = strSQL + "tbllocalscrap.[Date entered],"
strSQL = strSQL + "tbllocalscrap.[Time entered],"
strSQL = strSQL + "tbllocalscrap.[Name],"
strSQL = strSQL + "tbllocalscrap.[Shift],"
strSQL = strSQL + "tbllocalscrap.[Area],"
strSQL = strSQL + "tbllocalscrap.[Part Number],"
strSQL = strSQL + "tbllocalscrap.[WO Number],"
strSQL = strSQL + "tbllocalscrap.[Category],"
strSQL = strSQL + "tbllocalscrap.[Reason],"
strSQL = strSQL + "tbllocalscrap.[Qty],"
strSQL = strSQL + "tbllocalscrap.[Comments]"
strSQL = strSQL + " FROM tbllocalscrap"

cnt.Execute (strSQL)


Thanks for your time

Pat Hartman
04-22-2008, 04:09 PM
There doesn't seem to be any reason for this query to be dynamic. Put a break at the execute statement so you can capture the SQL string and paste it into the query designer SQL window. Running it from there will make detecting errors easier. Then execute the saved querydef rather than the SQL string.