Error in - QueryDef

G

Guest

hi,
In this action can create "QueryDef" but not delete "( Function,,,
restricted / type not supported)
strSQL = "insert into Exception values (1,1,1,1,1,1,1)"
Set qdf = dbs.CreateQueryDef("insert", strSQL)
qdf.Execute
dbs.DeleteQueryDef ("insert") <------- error here

thanks
 
A

aaron.kempf

insert into exception values(1,1,1,1,1,1,1)


this syntax only works if the table has 7 or 8 columns.. right? at
least in sql server it works that way; i think that you can sometimes
get away without writing the identity (autonumber to you mdb-peons)..
i swear it'll only let you use this syntax if it's got the correct #
of columns

you may need to

insert into exception (col1,col2,col3,col4,col5,col6)
values(1,1,1,1,1,1)

also


you really should just
Docmd.Runsql StrSql, True
 
T

Tony Toews [MVP]

SIN said:
In this action can create "QueryDef" but not delete "( Function,,,
restricted / type not supported)
strSQL = "insert into Exception values (1,1,1,1,1,1,1)"
Set qdf = dbs.CreateQueryDef("insert", strSQL)
qdf.Execute
dbs.DeleteQueryDef ("insert") <------- error here

Use the following instead

strSQL = "insert into Exception values (1,1,1,1,1,1,1)"
dbs.Execute strSQL, dbfailonerror

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
P

PFC Sadr

Tony;

what is the benefit of dbs.Execute vs Docmd.RunSql?

dbs.Execute doesn't always raise errors.. even with dbfailonerror
dbs.execute causes memory leaks; because all DAO causes memory leaks.

_RIGHT_

you really should just
Docmd.Runsql StrSql, True



thanks
 
G

Guest

thanks

Tony Toews said:
Use the following instead

strSQL = "insert into Exception values (1,1,1,1,1,1,1)"
dbs.Execute strSQL, dbfailonerror

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
P

PFC Sadr

my honest error is that using dbs.execute is errorprone because it
does not always raise an error when there is an error

LIKE SERIOUSLY DUDE
 
T

Tony Toews [MVP]

PFC Sadr said:
my honest error is that using dbs.execute is errorprone because it
does not always raise an error when there is an error

I've never had that problem.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
T

Tony Toews [MVP]

Another alias of A a r o n K e m p f.
what is the benefit of dbs.Execute vs Docmd.RunSql?

Docmd.runsql never raises errors
dbs.Execute doesn't always raise errors.. even with dbfailonerror

I've never had that problem.
dbs.execute causes memory leaks; because all DAO causes memory leaks.

Wrong.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
S

Susie DBA [MSFT]

how is it that DAO isn't a walking memory leak?

because you close your variables in the correct order?

NOT ACCEPTABLE!
 
S

Susie DBA [MSFT]

you're never had a problem with DBS.execute.. where Access won't raise
an error if there is one?

I just know I've seen this; i'll have to give you guys some examples
soon
I know it sure as shit; this is one of the main reasons I won't use
DAO
 

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