command button

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

Guest

I have 3 Command Buttons
I kind of know what to do but then I go south

Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I, False)
Me.[Label55].Visible = Me.[Employee]=N and [I/O]=I, False)
Me.[Label56].Visible = Me.[Employee]=Y and [I/O]=O, False)

It turns red. I have not done an AND like this before.

Thanks
Chey
 
To make it clearer to you the expressions after the first = is treated as a
boolean expression
you're obviously lacking some code, probably an iif statement, but I'll try
to "mock up" a working sample of your code
Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I
Would be more readable if expanded to
Me.[Print TA].Visible = (Me.[Employee]=Y) and ([I/O]=I)
and more understandable (?) idf expanded to
Me.[Print TA].Visible = ((Me.[Employee]=Y)=True) And (([I/O]=I)=True)
or
Me.[Print TA].Visible = IIF((Me.[Employee]=Y)=True and ([I/O]=I)=True,True,
False)

in "ingrish"
If The Control (Field) "Employee" is Equal to the variable Y AND the Control
(Field) "I/O" is Equal to the variable I Then Display the control "Print
TA", Else hide it

HTH

Pieter


Chey said:
I have 3 Command Buttons
I kind of know what to do but then I go south

Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I, False)
Me.[Label55].Visible = Me.[Employee]=N and [I/O]=I, False)
Me.[Label56].Visible = Me.[Employee]=Y and [I/O]=O, False)

It turns red. I have not done an AND like this before.

Thanks
Chey
 
I actually pulled this code from somewhere else and just placed in my info
and the AND. Do all of these code do the same thing? Can I just pick one?
I chose the first one and realized that instead of Y I needed to put YES.
Does this need to be "YES" Becasue doesen't YES mean the same as a check
box. I have a combo box with YES and NO.
Thanks for your help.

Pieter Wijnen said:
To make it clearer to you the expressions after the first = is treated as a
boolean expression
you're obviously lacking some code, probably an iif statement, but I'll try
to "mock up" a working sample of your code
Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I
Would be more readable if expanded to
Me.[Print TA].Visible = (Me.[Employee]=Y) and ([I/O]=I)
and more understandable (?) idf expanded to
Me.[Print TA].Visible = ((Me.[Employee]=Y)=True) And (([I/O]=I)=True)
or
Me.[Print TA].Visible = IIF((Me.[Employee]=Y)=True and ([I/O]=I)=True,True,
False)

in "ingrish"
If The Control (Field) "Employee" is Equal to the variable Y AND the Control
(Field) "I/O" is Equal to the variable I Then Display the control "Print
TA", Else hide it

HTH

Pieter


Chey said:
I have 3 Command Buttons
I kind of know what to do but then I go south

Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I, False)
Me.[Label55].Visible = Me.[Employee]=N and [I/O]=I, False)
Me.[Label56].Visible = Me.[Employee]=Y and [I/O]=O, False)

It turns red. I have not done an AND like this before.

Thanks
Chey

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4388 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 
no, better use true or -1 in code (instead of yes, as this is only a
formatting of Boolean values)
Yes = True = -1 = <> 0
No = False = 0

Access will usually convert "yes" to "true", but ...
Also, All statements ought to give the same result (barring typo's)
From your reply I gather you need to change [I/O]=I to Me.[I/O].Value = "I",
as well, to check against the litteral value 'I'.
You don't need to use Me & Value, as Access will figure that out, but it
helps to document your code (& executes faster in the bargain).

Pieter

Chey said:
I actually pulled this code from somewhere else and just placed in my info
and the AND. Do all of these code do the same thing? Can I just pick
one?
I chose the first one and realized that instead of Y I needed to put YES.
Does this need to be "YES" Becasue doesen't YES mean the same as a check
box. I have a combo box with YES and NO.
Thanks for your help.

Pieter Wijnen said:
To make it clearer to you the expressions after the first = is treated as
a
boolean expression
you're obviously lacking some code, probably an iif statement, but I'll
try
to "mock up" a working sample of your code
Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I
Would be more readable if expanded to
Me.[Print TA].Visible = (Me.[Employee]=Y) and ([I/O]=I)
and more understandable (?) idf expanded to
Me.[Print TA].Visible = ((Me.[Employee]=Y)=True) And (([I/O]=I)=True)
or
Me.[Print TA].Visible = IIF((Me.[Employee]=Y)=True and
([I/O]=I)=True,True,
False)

in "ingrish"
If The Control (Field) "Employee" is Equal to the variable Y AND the
Control
(Field) "I/O" is Equal to the variable I Then Display the control "Print
TA", Else hide it

HTH

Pieter


Chey said:
I have 3 Command Buttons
I kind of know what to do but then I go south

Me.[Print TA].Visible = Me.[Employee]=Y and [I/O]=I, False)
Me.[Label55].Visible = Me.[Employee]=N and [I/O]=I, False)
Me.[Label56].Visible = Me.[Employee]=Y and [I/O]=O, False)

It turns red. I have not done an AND like this before.

Thanks
Chey

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 4388 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
 

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