why am I getting this error?? 
Author Message
 why am I getting this error??

I keep getting the error:

run-time error '13': Type mismatch
while trying to run this code.  I got this directly from the sql view in the
query.  If I run the query, it works fine, but not in a module.  Why??

DoCmd.RunSQL "UPDATE ImportCust SET ImportCust.HTLPNM = " * " WHERE
(((ImportCust.HTLPNM) Is Null));"

I've tried changing the WHERE to = "", but I get the same error.

Please help!
Thanks,
Angi



Tue, 11 Nov 2003 04:24:49 GMT  
 why am I getting this error??
I think in transferring it to code and wrapping it in quotes, you forgot to
double up the quotes around the asterisk ("*"), so now it looks like you're
trying to multiply one quoted string by another.  Try this:

    DoCmd.RunSQL "UPDATE ImportCust SET ImportCust.HTLPNM = "" * "" WHERE
(((ImportCust.HTLPNM) Is Null));"

Note: the above has spaces around the asterisk, but that may be a mistake;
if so, fix it.
--

Dirk Goldgar
www.datagnostics.com
(to reply via email, remove NOSPAM from address)

Quote:

>I keep getting the error:

>run-time error '13': Type mismatch
>while trying to run this code.  I got this directly from the sql view in
the
>query.  If I run the query, it works fine, but not in a module.  Why??

>DoCmd.RunSQL "UPDATE ImportCust SET ImportCust.HTLPNM = " * " WHERE
>(((ImportCust.HTLPNM) Is Null));"

>I've tried changing the WHERE to = "", but I get the same error.

>Please help!
>Thanks,
>Angi



Tue, 11 Nov 2003 05:06:35 GMT  
 why am I getting this error??
Dirk,
Thank you for the tip...I'll try it.  In the meatime, I have yet ANOTHER error!

Again, pasted from sql and works in the query.

Error:  Expected:End of Statement
(highlights "LABOR")

docmd.RunSQL "UPDATE E "& _
            "SET E.[Other Chg Item] = IIf([E]![Component ID]="LABOR" Or
[E]![Component ID]="SUPPLY","Y","N");"

I see why it's doing it, but how do I use the IIf without the "'s?

Thanks,
Angi



Tue, 11 Nov 2003 05:48:23 GMT  
 why am I getting this error??
Any time you need to include double quotes within a string, you need to
double them:

docmd.RunSQL "UPDATE E "& _
            "SET E.[Other Chg Item] = IIf([E]![Component ID]=""LABOR"" Or
[E]![Component ID]=""SUPPLY"",""Y"",""N"");"

Alternatively, you could try changing the internal double quotes to single
quotes:

docmd.RunSQL "UPDATE E "& _
            "SET E.[Other Chg Item] = IIf([E]![Component ID]='LABOR' Or
[E]![Component ID]='SUPPLY','Y','N');"

HTH

--
Doug Steele, Microsoft Access MVP
http://i.am/DougSteele/


Quote:
> Dirk,
> Thank you for the tip...I'll try it.  In the meatime, I have yet ANOTHER
error!

> Again, pasted from sql and works in the query.

> Error:  Expected:End of Statement
> (highlights "LABOR")

> docmd.RunSQL "UPDATE E "& _
>             "SET E.[Other Chg Item] = IIf([E]![Component ID]="LABOR" Or
> [E]![Component ID]="SUPPLY","Y","N");"

> I see why it's doing it, but how do I use the IIf without the "'s?

> Thanks,
> Angi



Tue, 11 Nov 2003 06:11:16 GMT  
 why am I getting this error??
Dirk & Doug,
Thank you both very much for your help!  They both work!

Gratefully,
Angi



Tue, 11 Nov 2003 08:44:24 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Null Values - WHY am I getting this error?

2. Why am I getting this error ?

3. Why am I getting this error? works in other databases

4. Please Help: Why am I now getting this error

5. Why am I getting this message?

6. Why am I getting a Closed Recordset

7. VB4 16-bits: I am getting an error message when compiling

8. I am getting errors I can't pin down

9. i am getting error sending stdPic to out-of-Process Component

10. Help - I am getting an error using data control

11. I am getting an error Please help if you can

12. Why do i keep getting Error 3021???

 

 
Powered by phpBB® Forum Software