   VB6: Access Database programming and variables.
  Quick VB6 coding. Lets take on the variable question first. If you have a String Array, and lets say:TheArray(0) = "Bob"TheArray(1) = "Jim"TheArray(2) = "Bill"The only correct way to output JIM is by searching it correct? Lets say I want it to load up Jim, but without searching. He could be in any of those three, is there a way? Since I KNOW Jim will always be in there. But searching is fine.Anyways, same for Database programming.I know there are three names in a database (MICROSOFT ACCESS), in the fieldname called NAMES, Bob, Jim, and Bill are there.Is there a way so that I do not have to search for Jim in there. Basicly instead of:rsuserdata.MoveFirstrsuserdata.FindFirst "Name='" & username(Index) & "'" More likersuserdata.MoveFirstrsuserdata.?goto? "Name='" & username(Index) & "'" ..Basicly KNOWING where it is. Or would it be basicly the same? I know i'm having a tough time explaining it. Just so it wouldn't have to search for lets say when theres 200000 usernames. Go straight to the name.Is there a correct way or better way to find in variables and dbs? Basicly when the character loads up it will save there data to variables, and when they do something, lets say there HP drops 20, it will put it in the variable, then straight back into the Database, using edit and update... But it would have to search for the user first before placing it back in, so it knows where to go.   
  For searching through an array you can use a binary search which is faster than a linear search through every element in the array. Using a binary search does require the array contents be sorted which you can achieve with QuickSort for example, there are a few implementations in VB6 available on the 'Net if you Google it.Regarding your database question if you use ADO then you can do a straightforward SQL query to only return the record with the name "Jim", something like this:Dim Conn as new ADODB.ConnectionDim Command as new ADODB.CommandDim RecSet as ADODB.RecordSet'make the connection to the dbConn.Open "my connection string"Command.ActiveConnection = Conn'run the query and get a recordset back with the record/s we want, you'll'need to replace table_name with the name of your tableCommand.CommandText = "select * from table_name where names = 'jim'"RecSet = Command.Execute'now you can pull each column back like so, just replace "names" and'"some_other_column" with the column name in questionDim Foo = RecSet("names")Dim Bar = RecSet("some_other_column)'cleanupConn.closeThis way you only pull back those records which match your criteria, you don't need to iterate through every record looking for the one your interested in. For the connection string to use take a look at ConnectionStrings.com;  I have recently completed an entire database software system in VB6. Nightmare because the connection method is very bugged, in my case I used Jet engine ebcause thats what we were told to use. Anyway to find a specific record name in a specific record set theres a specific command. Well its not really for find a record it find all records equal to the criteria.deDatabase.rscomTable.Filter = "Fieldname = " & variable holding filter data You can also have it like this I think, I think thats the correct syntax:deDatabase.rscomTable.Filter = "Fieldname = 'filterData'"For example in your case.Dim varJim As stringvarJim = "Jim"deDatabase.rsuserdata.Filter = "Name = " & varJimdeDatabase.rsuserdata.MoveFirstThis would filter the record set to jim and then move the position to the first instance of Jim then you could draw up all the other details using .field I think. Or however you have them connected to a form.   