Visible Text Box

G

Guest

I am trying to create a way to have a date box visible or not depending on
when an option button is clicked. This is in a subform. Below is the coding
i was trying to use. Text95 being the date field box.

Private Sub Option97_Click()
If Me.Option97 = False Then
Me.Text95 = Visible
Else: Me.Text95 = invisible
End If

This field is to show if the perosn has attended the Introductionary Class
for the company. Check box saying they went and the date box appears to
enter the date.
What am i doing wrong?
Thanks
Carl
 
M

ManningFan

"What am i doing wrong?"

That's a mighty long list, Carl.

First off, name your text field txtDate, not Text95. And while you're
at it, change Option97 too. Arbitrary names for controls are
rediculous and only lead to confusion when the next hack takes over
your project.

Secondly, "invisible" isn't in Access' (or any other program's)
vocabulary. The proper syntax is:
Me.txtDate.Visible = True
or
Me.txtDate.Visible = False

"Me.Text95 = invisible" is now going to reside in my sig file because
it's the most rediculously stupid thing I've ever read on the Internet,
and I've been online since '92.
 
G

Guest

Comments like this certainly encourage people to seek help and information in
our newsgroup.
Have you also been a jerk since '92 or is this a more recent development?
 
G

Guest

Okay.
I guess I could have helped more, but for some reason I didn't even notice
the Invisible part. I guess I read the first line and immediately knew it
was in the wrong event.

Seriously, though, it really isn't a good idea to berate newbies who are
trying. We all started somewhere. In 1977 my first job was as a computer
operator. I remember when some of the programmers came into the computer
room and were complaining that the compiler was down. In my newbie
ignorance, I looked around the room at the CPUs, Tape Drives, Disk Drives,
Drum Drives, Printers, and banks of memory trying to figure out which of
these large commercial refrigerator sized boxes was the compiler.
 
G

Guest

Ok, I have made the changes, and it seems to work until i scroll to the next
person. The option is not checked and the date box is visible=true. I can
click on the option box and turn it off then back on and the date box will
appear.
I have the field Indoc as a Yes/No format.
I tried to put the same code into the BeforeUpdate also which did not work.
As for my naming convention... this is my working copy.. i could careless
if it is ridiculous or not... when i install it in the actual program, I
will make the names match and more logical.

Any other ideas? or is this just not really feasible?

Private Sub Option97_AfterUpdate()
If Me.Indoc = False Then
Me.Text95.Visible = False
Else: Me.Text95.Visible = True
End If
End Sub
 
G

Guest

To set the visible property for existing records, you need to test the
condition and set the property in the form's Current Event.
 
M

ManningFan

"this is my working copy.. i could careless
if it is ridiculous or not... when i install it in the actual program,
I
will make the names match and more logical."

Good plan. Nothing is more efficient than writing your code twice. At
least it keeps you employed longer, eh?
 
G

Guest

pretty much. i get paid if i am at work or not, or if i just sit and stare
at a computer monitor so why not write it twice and get a better
understanding of how it should work. Cutting and Pasting is easy but is not
inducive to learning.
 

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

Top