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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Status to Access Menu

Status
Not open for further replies.

Davidwazza

Programmer
Oct 31, 2003
16
AU
Hey,

I have a main form, which is used as a sort-of menu. At present, employees access a drop down select box - where their ID numbers are selected with their names etc.

This information is accessed via tblEmployees. In this also, there is a yes/no box, where employees have selected if they are a supervisor or not. This is called ysnSupervisor.

Righto, now there is a button on the menu form, which I would only access to employees with this yes/no box checked. How would the easiest way to undergo this? Also, is there a way to use the enable/disable button, where it appears darkened when it is disabled.

Ta, David.
 
Righto - some more information!

tblEmployees
ysnSupervisor - select if supervisor or not.

frmMenu - main menu toolbar.
Search - lookup field which looks at all employees.
cmdSupMenu - when pressed, should look at status to see if supervisor - MY PROBLEM!

This is my code when cmd button is pressed:

Dim Response

If DLookup("[ysnSupervisor]", "tblEmployees", "[strID] = " & Me![Search]) = True Then
DoCmd.OpenForm "frmNCOs", , , stLinkCriteria

Else
Response = MsgBox("Currently, You do not have access.", vbOKOnly + vbCritical + bDefaultButton2, "Error")

End If

Think my problem is strID is made up of two letters, and five numbers (unique field). It keeps popping up that
'The object doesn't contain the the Automation object 'XX11111."

I try to specify the criteria to "[strID] = 'XX11111'" in the DLookUp field, and this works - I think it has something to do with the '', but dont know how to fix!

Thanks for any help, David.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top