Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search table for username

Status
Not open for further replies.

pazgb

Programmer
Jun 9, 2003
60
US
i would like to code my startup form to search a table and compare it to the network login. I have the code to return the login name on the w2k box. And I have created a table with just 1 field called username.

table = tblUserAccess
field = username

can anyone help me out?
 
i figured it out


Dim dbTemp As DAO.Database
Dim rsTemp As DAO.Recordset

Set dbTemp = CurrentDb
Set rsTemp = dbTemp.OpenRecordset("tblUserAccess", dbOpenTable)

rsTemp.Index = "PrimaryKey"
rsTemp.Seek "=", LogOnName

If rsTemp.NoMatch Then
MsgBox "You are not authorized to access this database.", vbOKOnly, "WARNING"
rsTemp.Close
dbTemp.Close
Quit
End If
rsTemp.Close
dbTemp.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top