CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Posts
    2

    I"M Desperate!!!

    If anyone can help me...

    Here's my problem. I am trying to convert an application to accept a numeric ID number. ex. 0000072. Right now it uses IT00072. I have the app so it will download my data and put it in the database with a numeric ID. But...I can not get one of the forms to open. This forms function is to display the ID numbers on the tabs, and then allow the user to enter data into the appropiate flex grid. It works great with the IT format, but not the 00. The form will not even open. Heres where I error:

    With tbsOccupied.Tabs
    .Clear
    Do while Not rs.EOF
    .Add rs.AbsolutePosition + 1, rs!Site_Number, rs!Site_Number 'ERROR LINE
    rs.Move next
    Loop
    End with

    I have never used the Absolute Position, and really don't understand it. I have been struggling with this for days, and if anyone can give me some insite to a solution, I will be most grateful.
    Thanks so much
    Neiko


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: I"M Desperate!!!

    My guess is that the error you are getting is "Invalid key". This is because the key property MUST be a string that only evaluates to a string. Since the ID is numeric, an error will be raised. To solve this, you need to add at least one alphanumeric character to the key. Try This code:

    With tbsOccupied.Tabs
    .Clear
    Do while Not rs.EOF
    .Add rs.AbsolutePosition + 1, "T" & rs!Site_Number, rs!Site_Number 'error LINE
    rs.Move next
    Loop
    End with



    Just note when accessing a tab via it's index, you will need to prefix it with a "T".

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured