Passing references to tables to subs

Discussion in 'Questions (Windows Mobile)' started by LineCutter, May 31, 2007.

  1. LineCutter

    LineCutter Active Member Licensed User

    Time for another one...
    I'm trying to keep my code neat & small. I need to process data held in a table in one of my subs. BUT, I have several copies of the table schema, all holding different set of data & I want to process one dataset. (Merging the datasets does not seem a good idea, unless I've missed a trick when it comes to saving tables)

    How do I pass a table ID as a parameter to a sub, such that I can use <tableID>.cell() etc. within the sub?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Dependant on what you are doing with the tables i.e. if all of the data set have been created, then you can just access the cells directly.
    Tables and all other controls are Global objects.

    Regards,
    RandomCoder
     
  4. LineCutter

    LineCutter Active Member Licensed User

    Thanks Erel, that was the thing I was after. I must have missed that thread from the 10th somehow - I searched the docs, but missed the right keyword.

    RandomCoder: Thanks too. The tables could be accessed specifically, but I'd then need 3 (at least) subs to do the job, all differing only in the table name used inside them.
     
  5. RandomCoder

    RandomCoder Well-Known Member Licensed User

    LineCutter,

    I think you misunderstand me, I was meaning to load all three tables with data but then use just one sub to access whichever cells you require, something like...

    Sub DoSomeThing(TabelName,ColName,RowNumber)
    CellData=Control(TableName).Cell(ColName,RowNumber)
    ...
    ...
    End Sub

    This would be quicker than having to load the data into a single table each time you want to access a cell. Of course I don't know what you are populating the tables with or even whether you need to access data from more than one of the tables during normal operation. It's just another idea to add to the pot :D

    Regards,
    RandomCoder
     
  6. LineCutter

    LineCutter Active Member Licensed User

    RandomCoder, we're saying the same thing :)
    The plan is to use DoStuff(table,filter) to process temptable or authorisedtable. Obviously, with the same table format I can use the same sub. At the end of the day it's only authorisedtable that needs saving, which is why I want them separated.
     
Loading...