here is all of my code, I am creating random numbers, then assigning the random numbers into "virtual" tables based on users on the network.........maybe you can help me out with a better way to do this......
Dim strUser As Object
Set strUser = CreateObject("WSCRIPT.Network")
GetComputerName = Trim(strUser.ComputerName)
Private Sub Command0_Click()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strTableName As String
Dim Temp As String
Why are you dynamically creating keyed tables on the fly? Pablo no understand.
Juan no understand also...
Soo you are making a table with your comp name, and it has an ID field,which I am assuming that it is an autonumber...What else is in the table? Because if you just have a table with one autonumber field, it will never increase/populate, because an auto needs another field to start initialize the record. If the table's key is just your computer name, that just makes my head hurt. But if that is the case why go through the trouble of making a table? Can't you make a function that gets the computer name then assign it to that textbox?
ok so what does this ID represent? A random number can shoot out things like you have, but I have seen a random number shoot out like 452310453E-51. Do you think that would an acceptable ID and your user wouldn't go huh when they see that their ID is 452310453E-51? If it's to ID the user or computer why do you just use the computer name? Or even better if the users have ID's, the table is created and the computer name is looked up, then the person is asked for ID. Then when he/she reopens it the computer name is already in with th ID...
let me help you out, the IDnum is not a random number that is being generated....it is a random field that is already set.
IDNUM Lname FName
1234 smith John
3234 Kerry Jack
The code above pulls out randomly the IDNUM 1234 or 3234 then puts this random field into a table. The table is named after the computername.
so my result could be:
Now if I were to use this database on a different computer I would have a different computername so the result could be-
all I want to do is have a form that can recognize that the computername is Jackson and read the IDNUM
so if I were to pull up the form on my current computer (computername=kkondrat1) I want ID Num 1234 to show up in a textbox. If I was on the Jackson computername ID num 3234 will show up in the textbox.
Soo.. are you trying to deal with session management? Is that what you're saying? You are FAR better off having a field in an already existing table that you push a session id into then creating temporary tables..
So why don't you have a table with log in ID's (ID, LName, FName), then use that table to manage the users. Then use what Ted, DCKunkle (and you yourself kind of said it) mentioned? You may want to put in a temp table to maybe track who all signs in?