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

How do I display a character after clicking a check box? 2

Status
Not open for further replies.

Technyc2003

IS-IT--Management
Feb 10, 2004
39
US
I have a database for our Human Resources Dept and one of the fields on the main form is wether or not an employee is terminated. What I did was use a blank area of the form and created a label with a character of X as the caption. So that when the data entry person clicks on the Terminated check box that big ol' X will appear on that employee's record. Here's what I've done so far and it's not working.

I created a code procedure of After Update on the check box.

If Me![Check92] = "True" Then

Me![Term].Visible = True
Else
Me![Term].Visible = False

End If


I have the X label Visible property set to NO. So I'm not sure what to do. Any help is appreciated. Also, is it possible to once click that Terminated check box, display the X character and have the cursor automatically go into the Date of Termination field?

Thanks.

 
You just need to remove the quotation marks around 'true':

If Me![Check92] = True Then
Me![Term].Visible = True
Else
Me![Term].Visible = False
End If


-Gary
 
Hi!

Please state a bit more than "and it's not working". We'll need errormsg, what happens, what's expected to happen...

That said, a check box (unless it's three state) can have the values true (-1) or false (0). Toggling the visible property of the term label, could be done by:

[tt]Me![Term].Visible = Me![Check92].Value[/tt]

(or just remove the quotes around "True" in your original post)

If the checkbox value is true, then the term label is visible, if not true then not visible.

To set focus to another control:

[tt]Me!NameOfControl.SetFocus[/tt]

If the name of control contains spaces or special characters, then [brackets] are needed.

Here's a little faq on how to get the most out of the membership faq181-2886.

Post back if problems

Roy-Vidar
 
Wow - that must have been quick glalsop, I'm sure I pressed refresh;-)

Roy-Vidar
 
Oops, this should work for the second question:

If Me![Check92] = True Then
Me![Term].Visible = True
Else
Me![Term].Visible = False
End If

DateOfTerminationField.SetFocus

-Gary
 
Okay, I've taken out the quote marks and it seems like it works but then the X disappears when I exit the database. Also when I did click the check box it would appear but then when I went scrolling through each record the X would be on each record although I did not have a check mark in the terminated box.


 
Put the code in the on current event of the form too (perhaps not the setfocus part).

Roy-Vidar
 
If you want the 'X' to be persistent, then you need to display its value based on the value of a field.

So in addition to the After_Update event of the check box, you can use something like this in your Form_Current event:

If Me.Terminated = True Then
Me![Term].Visible = True
Else
Me![Term].Visible = False
End If


-Gary
 
Where Terminated is the name of the terminated field on your table.

-Gary
 
Thank you very much, it worked perfectly once I added the control to the OnCurrent of the form.

Lastly, would you happen to know why my tab forms flicker when moving the mouse around to different fields? It's sort of annoying. It doesn't happen with my other normal forms in databases I've done in the past just ones where there several tabs in the form.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top