Run-time error 3061

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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName, JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone, ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region] AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName] AS Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS Expr12
FROM WOTempTable;

Thanks, JIM
 
G

Guest

Get rid of all of the AS Expr# as they clog the vision during debugging.
Then, run the query in a query window, and see what parameter prompts you
get. Address each.
 
G

Guest

Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName, JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone, ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region, WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName, WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3, WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile, WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

S.Clark said:
Get rid of all of the AS Expr# as they clog the vision during debugging.
Then, run the query in a query window, and see what parameter prompts you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



JIM said:
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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName, JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone, ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region] AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName] AS Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS Expr12
FROM WOTempTable;

Thanks, JIM
 
J

John Spencer

12 missing parameters, 12 fields. Coincidence? - No.

I suspect that your field names are wrong in one of the two tables.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region, WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName, WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3, WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile, WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

S.Clark said:
Get rid of all of the AS Expr# as they clog the vision during debugging.
Then, run the query in a query window, and see what parameter prompts you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



JIM said:
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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region] AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName] AS
Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS
Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS
Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS
Expr12
FROM WOTempTable;

Thanks, JIM
 
G

Guest

I thoroughly checked the field names in the WOProduction table and the names
on the Excel spreadsheet and they are identical. Access creates a table,
WOTempTable, which has 13 fields, F1-F13. The fields are all size of 255 and
1 number field is defined as double. This is just a link, I think. But why
13 fields when I have only 12 described? Any help is appreciated. JIM

John Spencer said:
12 missing parameters, 12 fields. Coincidence? - No.

I suspect that your field names are wrong in one of the two tables.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region, WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName, WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3, WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile, WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

S.Clark said:
Get rid of all of the AS Expr# as they clog the vision during debugging.
Then, run the query in a query window, and see what parameter prompts you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



:

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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region] AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName] AS
Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS
Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS
Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS
Expr12
FROM WOTempTable;

Thanks, JIM
 
J

John Spencer

If your field names are correct, did you check the tablename(s). Is the
source table named WOTempTable? Could it be W(zero)TempTable?

How about the name of the target table?

If you run the query (AppendNewWOs) from the query window, does it fail or
give you problems of any type?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
I thoroughly checked the field names in the WOProduction table and the
names
on the Excel spreadsheet and they are identical. Access creates a table,
WOTempTable, which has 13 fields, F1-F13. The fields are all size of 255
and
1 number field is defined as double. This is just a link, I think. But
why
13 fields when I have only 12 described? Any help is appreciated. JIM

John Spencer said:
12 missing parameters, 12 fields. Coincidence? - No.

I suspect that your field names are wrong in one of the two tables.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region, WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName, WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3, WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile, WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

:

Get rid of all of the AS Expr# as they clog the vision during
debugging.
Then, run the query in a query window, and see what parameter prompts
you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



:

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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region]
AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName]
AS
Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS
Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS
Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS
Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS
Expr12
FROM WOTempTable;

Thanks, JIM
 
G

Guest

The only place WOTempTable is described is in my code I didn't create a table
for it.
Isn't my source the excel files from
C:\Documents and Settings\CMC\New Work Orders\ ? I thought my code is to
create a link only and then append to my production table.
Originally I had a table described for WOTempTable but the code outputs its
own version of WOTempTable. (It looks like an excel input of some kind.)
Looking at the WOProduction table I noticed that there are 13 contiguous
fields and only 12 of those are moved from the excel files to the
WOTempTable. The next to last field is not moved from excel files but is
updated via a form. I realize I am missing a very important step but don't
know what.
Thanks, JIM

Thanks, JIM

John Spencer said:
If your field names are correct, did you check the tablename(s). Is the
source table named WOTempTable? Could it be W(zero)TempTable?

How about the name of the target table?

If you run the query (AppendNewWOs) from the query window, does it fail or
give you problems of any type?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
I thoroughly checked the field names in the WOProduction table and the
names
on the Excel spreadsheet and they are identical. Access creates a table,
WOTempTable, which has 13 fields, F1-F13. The fields are all size of 255
and
1 number field is defined as double. This is just a link, I think. But
why
13 fields when I have only 12 described? Any help is appreciated. JIM

John Spencer said:
12 missing parameters, 12 fields. Coincidence? - No.

I suspect that your field names are wrong in one of the two tables.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region, WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName, WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3, WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile, WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

:

Get rid of all of the AS Expr# as they clog the vision during
debugging.
Then, run the query in a query window, and see what parameter prompts
you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



:

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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1, [WOTempTable].[Region]
AS
Expr2, [WOTempTable].[WODate] AS Expr3, [WOTempTable].[ClientName]
AS
Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS
Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3] AS
Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS
Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType] AS
Expr12
FROM WOTempTable;

Thanks, JIM
 
J

John Spencer

If you don't have the table you can't reference it.

Perhaps the failure is related to this line

DoCmd.TransferSpreadsheet acLink, , "WOTempTable", strPath & strFileName,
True 'Link Excel file to Temptable

Try adding a couple of lines of code right after you call the above line.
It may be that the new linked table is not "visible" at this point.

DoEvents
CurrentDb().TableDefs.Refresh
DoEvents



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
The only place WOTempTable is described is in my code I didn't create a
table
for it.
Isn't my source the excel files from
C:\Documents and Settings\CMC\New Work Orders\ ? I thought my code is to
create a link only and then append to my production table.
Originally I had a table described for WOTempTable but the code outputs
its
own version of WOTempTable. (It looks like an excel input of some kind.)
Looking at the WOProduction table I noticed that there are 13 contiguous
fields and only 12 of those are moved from the excel files to the
WOTempTable. The next to last field is not moved from excel files but is
updated via a form. I realize I am missing a very important step but
don't
know what.
Thanks, JIM

Thanks, JIM

John Spencer said:
If your field names are correct, did you check the tablename(s). Is the
source table named WOTempTable? Could it be W(zero)TempTable?

How about the name of the target table?

If you run the query (AppendNewWOs) from the query window, does it fail
or
give you problems of any type?


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

JIM said:
I thoroughly checked the field names in the WOProduction table and the
names
on the Excel spreadsheet and they are identical. Access creates a
table,
WOTempTable, which has 13 fields, F1-F13. The fields are all size of
255
and
1 number field is defined as double. This is just a link, I think.
But
why
13 fields when I have only 12 described? Any help is appreciated. JIM

:

12 missing parameters, 12 fields. Coincidence? - No.

I suspect that your field names are wrong in one of the two tables.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Thanks, my query now looks like this:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate, ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT WOTempTable.WorkOrderID, WOTempTable.Region,
WOTempTable.WODate,
WOTempTable.ClientName, WOTempTable.JobName,
WOTempTable.JobAddress1,
WOTempTable.JobAddress2, WOTempTable.JobAddress3,
WOTempTable.Contact,
WOTempTable.ContactPhone, WOTempTable.ContactMobile,
WOTempTable.WOType
FROM WOTempTable;
It is still giving the same message - Run-time error '3061': Too few
parameters. Expected 12. What do I do next?
Thanks for your help, JIM

:

Get rid of all of the AS Expr# as they clog the vision during
debugging.
Then, run the query in a query window, and see what parameter
prompts
you
get. Address each.


--
Steve Clark,
Former Access MVP
FMS, Inc
http://www.fmsinc.com/consulting



:

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.
Here is code for AppendNewWOs:
INSERT INTO WOProduction ( WorkOrderID, Region, WODate,
ClientName,
JobName,
JobAddress1, JobAddress2, JobAddress3, Contact, ContactPhone,
ContactMobile,
WOType )
SELECT [WOTempTable].[WorkOrderID] AS Expr1,
[WOTempTable].[Region]
AS
Expr2, [WOTempTable].[WODate] AS Expr3,
[WOTempTable].[ClientName]
AS
Expr4,
[WOTempTable].[JobName] AS Expr5, [WOTempTable].[JobAddress1] AS
Expr6,
[WOTempTable].[JobAddress2] AS Expr7, [WOTempTable].[JobAddress3]
AS
Expr8,
[WOTempTable].[Contact] AS Expr9, [WOTempTable].[ContactPhone] AS
Expr10,
[WOTempTable].[ContactMobile] AS Expr11, [WOTempTable].[WOType]
AS
Expr12
FROM WOTempTable;

Thanks, JIM
 

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

Similar Threads

Run-time error 3061 excel to access 1
Error 2471 10

Top