Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Problems!

Status
Not open for further replies.

FoxStudent

Technical User
Feb 24, 2000
85
GB
Why is that the line marked *** in this piece of code keeps giving me the error two few paramaters. I have looked at help and the line seems to be alright. Has anyone any sugestions? If so please help me. Thank u!

Function BuildResultsTable(sSQL As String, sTableName As String, lRecordsAffected As Long)
Dim db As Database
Dim qdfAction As QueryDef
Set db = CurrentDb
On Error Resume Next
db.TableDefs.Delete sTableName
On Error GoTo 0
sSQL = Replace(sSQL, " FROM ", " INTO " & sTableName & " FROM ")
Set qdfAction = db.CreateQueryDef("", sSQL)
qdfAction.Execute dbFailOnError
lRecordsAffected = qdfAction.RecordsAffected
qdfAction.Close
BuildResultsTable = True
End Function
 
I am assuming that it is the line:
qdfAction.Execute dbFailOnError
that is giving you the error.

My suggestion would be to put a breakpoint on that line. When the code pauses, go into the immediate window (Ctrl-G to access) and type

?ssql

This will return the SQL that you are trying to execute. Copy it and paste it into a new query and see what happens. I have used this method many time to debug SQL.

Hope that helps.

Kathryn
Kathryn


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top