Hello
Why do you think a create table query doesn't create table from the
following code?
Set myQuery = myDB.QueryDefs("qryCON absent adults previous day log")
myQuery.Execute
If I execute the query myself, it creates the table perfectly well.
When executed from code, an error is 3061: too few parameters. Expected
1.
The query is:
SELECT [qryCON absent students per day].[PERSON_CODE], [qryCON absent
students per day].[DAY], [qryCON absent students per day].[START_TIME],
[qryCON absent students per day].[SBJ_CODE_P], [qryCON absent students
per day].[CAL_OCC_P], [qryCON absent students per
day].[FES_SPONSOR_CODE], [qryRegister Student Comments].[EVENT_DATE],
[qryRegister Student Comments].[Expr1] AS Comment INTO [tblCON absent
students per day]
FROM ([qryCON absent students per day] INNER JOIN [qryCON Absent
students per day >2] ON [qryCON absent students per
day].[PERSON_CODE]=[qryCON Absent students per day >2].[PERSON_CODE])
LEFT JOIN [qryRegister Student Comments] ON [qryCON absent students per
day].[PERSON_CODE]=[qryRegister Student Comments].[StuCode];
As you can see, it is based on 3 other queries. If it works on it's
own, it surely should work from code.
Any help will be greatly appreciated.
Thank you. 3 1854
Galka wrote:
If it works on it's
own, it surely should work from code.
No, if it contains brackets to fix syntax errors and is copied somewhere else,
it *might* work but it's not guaranteed. Avoid syntax errors by only using
alphanumeric characters and the underscore in names, and don't use reserved
words like day as a name. Then see if your query works.
--
Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200611/1
Granny Spitz via AccessMonster.com wrote:
Galka wrote:
If it works on it's
own, it surely should work from code.
No, if it contains brackets to fix syntax errors and is copied
somewhere else, it *might* work but it's not guaranteed. Avoid
syntax errors by only using alphanumeric characters and the
underscore in names, and don't use reserved words like day as a name.
Then see if your query works.
Also, queries run in the Access GUI can use the Expression Service to resolve
certain expressions like form references and calls to certain VBA functions.
The same query run in code does not have the Expression Service at its disposal.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Thank you to both of you gentlemen.
Your explanation opened my eyes. I have got such mysteries now and then
over the years and never could understand why.
Galina
Rick Brandt wrote:
Granny Spitz via AccessMonster.com wrote:
Galka wrote:
If it works on it's
own, it surely should work from code.
No, if it contains brackets to fix syntax errors and is copied
somewhere else, it *might* work but it's not guaranteed. Avoid
syntax errors by only using alphanumeric characters and the
underscore in names, and don't use reserved words like day as a name.
Then see if your query works.
Also, queries run in the Access GUI can use the Expression Service to resolve
certain expressions like form references and calls to certain VBA functions.
The same query run in code does not have the Expression Service at its disposal.
--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jim Geissman |
last post by:
I have function that returns a table of information about properties. The
data comes from three different tables -- addresses (called PropertyID),
property characteristics, and events concerning...
|
by: lev |
last post by:
CREATE TABLE .
(
NULL ,
,
(44)
)
ID is non-unique. I want to select all IDs where the last entry for
that ID is of type 11.
|
by: jim_geissman |
last post by:
I have encountred situations like this before, but this one
has me stumped.
I have a pretty simple SP that collects information about
residential properties from a large database. First step is...
|
by: meltedown |
last post by:
Why doesn't this return anything ?
SELECT DATE_SUB('FROM_DAYS(TO_DAYS(2005-09-28 18:04:19))', INTERVAL 6 DAY)
|
by: William Wisnieski |
last post by:
Hello Everyone:
I'm having a very strange problem occurring with my Access 2000 database. I
call it the "mystery record."
Here's the story:
I have a query by form that returns a record set...
|
by: Mark |
last post by:
I have a table about people containing 25 fields. The table contains the usual
fields - first, last, address, city, state and zip. There is no primary key.
These fields all have data with the...
|
by: GaryDave |
last post by:
My school registration database has not been quite right after a recent
compact and repair (done while I was away). Though most of the many
forms and subforms are working normally, one form in...
|
by: Mark Shelor |
last post by:
I've encountered a troublesome inconsistency in the C-language Perl
extension I've written for CPAN (Digest::SHA). The problem involves the
use of a static array within a performance-critical...
|
by: creative1 |
last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |