Define Keyword as Variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I do want to define Keywords as a variable, if possible. For instance, I
want to have control visible or not depending on an entry in a table of
parameters referring to the user. The command i would use should state

MyControl.Visible = DLookUp("User0";"tabParameter";"UserName = XYZ")

whereby the field User0 contains either the string False or True.
The way stated above is not working, as Access does not interprete a simple
string as a Keyword.

I know, I can do this by using

IIf(DLookUp("User0";"tabParameter";"UserName = XYZ") = "False" Then
MyControl.Visible = False
Else
MyControl.Visible = True
End If

but isn't there another way to define the string that way, that Access
accepts it as a Keyword ? Much obliged for any help. Thanks.

Ulrich 1947
 
Eval() should be able to evalutate the string "True" or "False" for you.

Use Nz() in case the record is not found.

MyControl.Visible = Eval(Nz(DLookUp("User0", "tabParameter", "UserName =
'XYZ'"), "False"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top