Thank you very much for your reply.
What I really want to do is to grant a user his right to access the menu. I stored the userID and its rights in a table, as follow(The first line is column name, the DB is MS SQL Server):
employeeID menuItem Checked Enabled Visible
010100010001 mBOM 1 1 0
010100010001 mBOO 0 0 0
010100010001 mCRP 0 0 0
010100010001 mMRP 0 0 0
I use the following codes to set the access right to the menu:
SQLQuery = "SELECT * from tMenuItemGrant WHERE employeeID='" & strEmployeeID & "'"
Set sqlResult = cn.Execute(SQLQuery)
If sqlResult.EOF = False Or sqlResult.BOF = False Then
sqlResult.MoveFirst
Else
Exit Sub
End If
Do While sqlResult.EOF = False
strMenuItemWhole = "frmERP."
strMenuItem = sqlResult("menuItem"

bolChecked = sqlResult("Checked"

bolEnabled = sqlResult("Enabled"

bolVisible = sqlResult("Visible"
If Len(Trim(strMenuItem)) > 0 Then '* The menuitem is not a blank one
strMenuItemWhole = strMenuItemWhole & strMenuItem & "."
strMenuItemWhole = strMenuItemWhole & "Checked"
strMenuItemWhole = bolChecked
strMenuItemWhole = strMenuItemWhole & "Enabled"
strMenuItemWhole = bolEnabled
strMenuItemWhole = strMenuItemWhole & "Visible"
strMenuItemWhole = bolVisible
End If
sqlResult.MoveNext
Loop
I want it to realize the following function:
frmERP.mBOM.Checked=False
frmERP.mBOM.Enabled=False
.....
But It does not work as what I wanted.