Solved: error in sql in vb

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Charmian

Thread Starter
Joined
Mar 6, 2012
Messages
199
Hi
I'm getting a type mismatch error from my sql statement - how do I actually see what is in the variable when I go into debug mode. I don't know why the bottom half of my screen doesn't show me the variables - I must have changed something but don't know what!
sql2 = " UPDATE ASSET SET ASSET.CurrentWSID = " & Combo55(2) & _
"where AssetNo = "" & Combo57(1) & "" ;"

I've assumed that my combo from the form numbers from 0, and I expect combo55(2) to be a number.
Combo57(1) is Assetnumber and that is a text field.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
I am not sure what Combo55(2) and Combo57(1) are?
If they are meant to be the Combo columns then
it should be combo55.Column(2) and Combo57.Column(1)
You can always add a line of code
msgbox Combo55(2) & " - " & Combo57(1)
assuming they are not the combo columns.
 

Charmian

Thread Starter
Joined
Mar 6, 2012
Messages
199
Thank you OBP! It was the .column that was left out and I would have looked at that for ages and not being able to see the problem!
 
Joined
Sep 4, 2003
Messages
4,912
I know this has been solved already but just for future reference you can show the value of a variable by opening the VB editor and then click VIEW >> IMMEDIATE WINDOW and then use the debug.print statement in your code to print the value to the debug window at the bottom.

debug.print sql2
Rollin
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Rollin, the interesting thing about this problem is that neither debug.print or Msgbox would have solved it, because the item to be "displayed" did not in fact exist.
 

Charmian

Thread Starter
Joined
Mar 6, 2012
Messages
199
I know this has been solved already but just for future reference you can show the value of a variable by opening the VB editor and then click VIEW >> IMMEDIATE WINDOW and then use the debug.print statement in your code to print the value to the debug window at the bottom.



Rollin
Thank you , that was the second part of my question - But sometimes you can see something, and what you see is not what is actually typed there......
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top