1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: error in sql in vb

Discussion in 'Business Applications' started by Charmian, Feb 4, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. Charmian

    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.
     
  2. OBP

    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.
     
  3. Charmian

    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!
     
  4. Rollin_Again

    Rollin_Again

    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.

    Rollin
     
  5. OBP

    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.
     
  6. Charmian

    Charmian Thread Starter

    Joined:
    Mar 6, 2012
    Messages:
    199
    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......
     
  7. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1088162

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice