If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
assigning items from a list of 1000 to a form field
I have a list of 1000 discrete passwords (and that list
may grow from time to time). I'd like a system where when I click a command button ("Generate Password"), Access will take the first password from the list, insert it in a text box on a form (that will then be stored in a master table with the record for the particular user), and then delete that password from the list so it can't be used again. Again thought? Thanks, Steve |
#2
|
|||
|
|||
assigning items from a list of 1000 to a form field
"sek0910" wrote in
: it in a text box on a form (that will then be stored in a master table with the record for the particular user), and then delete that password from the list so it can't be used again. Again thought? public function GetNextPassword() as string dim strSQL as String dim strAnswer as string dim db as Database ' get "next" password, whatever that means strsql = "select top 1 ptext from passwords " & _ "order by ptext" ' handle to database set db = currentdb() ' catch the null answer if there are no records left ' you could use a NZ() just as well strAnswer = dfirst("ptext", strsql) & vbNullString ' was it okay? If len(stranswer)0 then ' yes; delete if from the list strsql = "delete from passwords " & _ "where ptext = """ & stranswer & """" ' brave here -- no error trapping! db.execute strsql, dbfailonerror End If ' return the password GetNextPassword = strAnswer End Function Not tested, so usual caveats apply, but it's not very complicated. Hope it helps Tim F |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
auto entry into second table after update | Tony | New Users | 13 | July 9th, 2004 10:42 PM |
Adding new field to existing form | Joe | Database Design | 2 | June 22nd, 2004 11:02 PM |
Recordset in subform based on field in parent form | Lyn | General Discussion | 15 | June 14th, 2004 03:10 PM |
display list box items per field selection on linked form | neen | Using Forms | 7 | June 14th, 2004 08:05 AM |
NUMBERING the pages | Bob | New Users | 7 | June 14th, 2004 12:20 AM |