CurrentDb.Execute problem?

  • Thread starter Thread starter TC
  • Start date Start date
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
 
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
 
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
 
Back
Top