Run-Time Error '13' in Form only

M

MF Scheetz

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
 
J

jeff

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
 
M

MF Scheetz

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

 

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