CurrentDb.Execute problem?

T

TC

Add:

, dbFailOnError

to the end of your .Execute statement. This tells that statement to stop
with an error if any record can not be updated, for some reason. Without
that parameter, the Execute does whatever updates it can, and ignores
whatever ones it can't - and it does not display an error for the latter.

HTH,
TC
 
B

Bill Stanton

The segment of code below runs without apparent error.
However, the Volumes table does not get updated!
What would prevent that?

tmpSQL = "INSERT INTO [Volumes](CatNo,CtlgPrefix,CtlgNo,MediaType)"
tmpSQL = tmpSQL & " VALUES(" & NewCatNo & ",""" & LastCtlgPrefix & """, "
tmpSQL = tmpSQL & """" & NewCtlgNo & """, " & LastMediaType & ");"
CurrentDb.Execute tmpSQL

I printed the Values list to be sure it was okay. It reads:
VALUES(191,"CD-","CD-191",2)

Thanks,
Bill
 
B

Bill Stanton

Got it TC, the error message quickly led me to the fix.
Thanks,
Bill

TC said:
Add:

, dbFailOnError

to the end of your .Execute statement. This tells that statement to stop
with an error if any record can not be updated, for some reason. Without
that parameter, the Execute does whatever updates it can, and ignores
whatever ones it can't - and it does not display an error for the latter.

HTH,
TC



Bill Stanton said:
The segment of code below runs without apparent error.
However, the Volumes table does not get updated!
What would prevent that?

tmpSQL = "INSERT INTO [Volumes](CatNo,CtlgPrefix,CtlgNo,MediaType)"
tmpSQL = tmpSQL & " VALUES(" & NewCatNo & ",""" & LastCtlgPrefix & """, "
tmpSQL = tmpSQL & """" & NewCtlgNo & """, " & LastMediaType & ");"
CurrentDb.Execute tmpSQL

I printed the Values list to be sure it was okay. It reads:
VALUES(191,"CD-","CD-191",2)

Thanks,
Bill
 

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