Run-time error 3061 excel to access

G

Guest

Using Access 2000 I'm trying to convert excel files to access with this code:

Private Sub LoadNewWorkOrders_Click()
Dim strPath As String
Dim strFileName As String

strPath = "C:\Documents and Settings\CMC\New Work Orders\"
'Path to directory where new w/os are
strFileName = Dir(strPath & "*.xls")
'Dir function returns only Excel files

Do While Len(strFileName) <> 0
'After Dir function returns all .xl files, it returns a zero length string ""
If IsNull(DLookup("[Filename]", "tblImportedFiles", "[FileName] = '" &
strFileName & "'")) Then 'If file is not found then enter loop
DoCmd.TransferSpreadsheet acLink, , "WOTempTable", strPath &
strFileName, True 'Link Excel file to Temptable

CurrentDb.Execute ("AppendNewWOs"), dbFailOnError
'Execute AppendQuery
that reads from TempTable and Appends the records to production table

DoCmd.DeleteObject acTable, "WOTemptable"
'Delete link, but not the file

CurrentDb.Execute ("INSERT INTO tblImportedFiles(
[FileName],[ImportDate] ) Values ('" & strFileName & "', #" & Date & "#);"),
dbFailOnError
'Insert file into work orders
End If

strFileName = Dir()
Loop

End Sub

I have a button on my form which calls LoadNewWorkOrders and it hangs up on
line
CurrentDb.Execute ("AppendNewWOs"), dbFailOnError
with a Run-time error 3061
Too few parameters. Expected 12.
Can you tell me what this means? I have searched the knowledge base and not
found anything similar to my problem. Thanks, JIM
 
G

Guest

Yout stored query AppendNewWOs is a parameterized query and it can't resolve
the parameter references.
In Plain language, there is a something in the WHERE clause it can't
understand.

I would suggest reposting in the Queries group with the SQL of your query
and describe your problem. Referencing the error and line on which the error
occurs is really good. Makes it easy to find an answer. You don't know how
many posts you see out here that are like"

My Query blew off and I got no data. Can you tell me what I did wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top