I'm running this code in the On_Load event form a form.
I want it to look at all records in the table, but it is only recognizing the last record in the table. I don't know what is wrong. Any help is greatly appreciated. Thanks
Dim Permission as Integer
Dim dbs As Database
Dim rdsDistMaster as recordset
Set dbs = CurrentDb
Set rdsDistMaster = db.Openrecordset("Select DistMaster from tblDistMaster"
rdsDistMaster.movefirst
Do Until rdsDistMaster.EOF = True
If fOSUserName = rdsDistMaster("DistMaster"
Then
Permission = 1
Else
Permission = 0
End If
rdsDistMaster.movenext
Exit Do
Loop
I want it to look at all records in the table, but it is only recognizing the last record in the table. I don't know what is wrong. Any help is greatly appreciated. Thanks
Dim Permission as Integer
Dim dbs As Database
Dim rdsDistMaster as recordset
Set dbs = CurrentDb
Set rdsDistMaster = db.Openrecordset("Select DistMaster from tblDistMaster"

rdsDistMaster.movefirst
Do Until rdsDistMaster.EOF = True
If fOSUserName = rdsDistMaster("DistMaster"

Permission = 1
Else
Permission = 0
End If
rdsDistMaster.movenext
Exit Do
Loop