Quote:
Originally Posted by SparrowHawk7
Would this work? Say I made a UDT and set each one in an array Player(0-59)
Code:
x=0
Do until Player(x).name = "Bob Jones"
x=x+1
loop
'x now contains the index of the UDT I want
It would usually work, with two exceptions.
The first would create an error, which is when the item you are looking for is not found in the array (as you will try to access an array element that doesn't exist). You need to exit the loop if x is bigger than the UBound (and then not run the rest of the code, and probably show a message to the user).
The second exception would cause a bug, and is something I briefly mentioned before - if a case ever occurs where two players have the same name, at some point searching by name will give you the wrong player. Unless you have a good reason to do otherwise, I would recommend searching by something that is guaranteed to be unique - such as the AutoNumber from the database.
Quote:
I haven't tried this but they seem like it'd work. Would it be possible to use a SQL statement to locate the UDT that I wanted? That would be simplest but I don't understand enough of SQL to see how it would be done.
You cannot use SQL on arrays (whether they are UDT's or other data types), only on databases of some kind.
Quote:
Is it possible to array the UDT by the player name? ... there are only 60 of them so memory allocation shouldn't be a problem.
I'm not sure what you meant by that, but as above I would recommend not focussing on the name.
Quote:
This is an aside question - once upon a time I seem to recall being able to enlarge the samples in MSDN by using the wheel in conjunction with CTRL or something. ...
I just checked, and you need to use the menu, "View"->"Fonts"
Quote:
Sorry to be a pain ... (it's kinda my nature I suppose ... I'm the curious sort) :rolleyes: I like to be sure I really understand something before moving on - things have a nasty way of building on one another and if I don't get something understood that's at the bottom, the rest is then built on a house of cards.
Don't be sorry about that - it's the opposite that annoys people. ;)