Run-Time Error '13' in Form only

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a form running a bunch of queries, the last query updates a field
"intPerc" that shows what percent the current value is of the yearly total:

dim db as DAO.Database
set db = CurrentDB

db.Execute "UPDATE tempDR AS A LEFT JOIN tempYearSum AS B ON A.txtLoanNo =
B.txtLoanNo AND A.dteBegin Like " * " & B.BgtYear SET A.intPerc =
[A].[intActExp]/.[Total];"
'updates the percentage of each disbursement/year

When the form runs this update query I get the Error '13' runtime error,
Type mismatch.

If I copy the SQL into a blank Query's SQL view, and click run, the query
runs with no problems.

Any one have any ideas why this update doesn't work in VBA but it does as an
Access Query?

-Matt
 
without looking to deeply into this...it appears you have a double quoted
statement inside the double quotes...ie

"UPDATE .... " * " ...." which should be "UPDATE .... ' * ' ...."

apart from that I guess if it works in the query view then the rest of the
syntax must be ok...

hope that helps..
cheers
jeff
 
Thanks a lot Jeff. That worked perfectly.

-Matt

jeff said:
without looking to deeply into this...it appears you have a double quoted
statement inside the double quotes...ie

"UPDATE .... " * " ...." which should be "UPDATE .... ' * ' ...."

apart from that I guess if it works in the query view then the rest of the
syntax must be ok...

hope that helps..
cheers
jeff


MF Scheetz said:
I've got a form running a bunch of queries, the last query updates a field
"intPerc" that shows what percent the current value is of the yearly
total:

dim db as DAO.Database
set db = CurrentDB

db.Execute "UPDATE tempDR AS A LEFT JOIN tempYearSum AS B ON A.txtLoanNo =
B.txtLoanNo AND A.dteBegin Like " * " & B.BgtYear SET A.intPerc =
[A].[intActExp]/.[Total];"
'updates the percentage of each disbursement/year

When the form runs this update query I get the Error '13' runtime error,
Type mismatch.

If I copy the SQL into a blank Query's SQL view, and click run, the query
runs with no problems.

Any one have any ideas why this update doesn't work in VBA but it does as
an
Access Query?

-Matt

 
Back
Top