Text box visibility remains same after every record

A

Agnelo Fernandes

I have a combobox of 'Courses'. Based on the course I select the visibility
of text box 'course date' is affected. By default - the course date text box
is set to invisible.
Eg: If I select undergraduate course only then the course date is visible
else its invisible. This works fine for me.

However, when i move from 1 record to another record. The visibility of the
course date text box is still true based on course I selected from the
previous record when i would actually want the 'course date' of the new
record to be invisible.

Can you help me in this? The code I used is:

Private Sub Other_AfterUpdate()
If Me.Other = "Introduction to Medicine" Or Me.Other = "Simulation
Instructor Training" Then
Me.CourseDate2.Visible = True
Else: Me.CourseDate2.Visible = False
End If
End Sub

Note: 'Other' is the name of combobox used to list a number of courses. Only
when 'introduction of medicine' or 'simulation instructor training' is
selected then coursedate2 text box becomes visibile else its invisible.
 
D

Dirk Goldgar

Agnelo Fernandes said:
I have a combobox of 'Courses'. Based on the course I select the visibility
of text box 'course date' is affected. By default - the course date text
box
is set to invisible.
Eg: If I select undergraduate course only then the course date is visible
else its invisible. This works fine for me.

However, when i move from 1 record to another record. The visibility of
the
course date text box is still true based on course I selected from the
previous record when i would actually want the 'course date' of the new
record to be invisible.

Can you help me in this? The code I used is:

Private Sub Other_AfterUpdate()
If Me.Other = "Introduction to Medicine" Or Me.Other = "Simulation
Instructor Training" Then
Me.CourseDate2.Visible = True
Else: Me.CourseDate2.Visible = False
End If
End Sub

Note: 'Other' is the name of combobox used to list a number of courses.
Only
when 'introduction of medicine' or 'simulation instructor training' is
selected then coursedate2 text box becomes visibile else its invisible.


You must also use the form's Current event to perform the same check and set
the Visible property. That way the visibility will be reset for each record
you move to.
 
A

Agnelo Fernandes

So you mean the same code in the current event of the form. I dont see
'current event' in the options of the control box. There are only: after
update, before update, on dirty, etc

where can i find current event ?
 
D

Dirk Goldgar

Agnelo Fernandes said:
So you mean the same code in the current event of the form. I dont see
'current event' in the options of the control box. There are only: after
update, before update, on dirty, etc

where can i find current event ?

Yes, I mean the Current event of the form. On the Event tab of the property
sheet of the form, you'll see the "On Current" property. That is where you
set event-handling for the Current event of the form.

Note: you'll often hear people speak of the "On Current" event or "On Open"
event. Those aren't actually the event names, though; those are just the
names of the form properties that establish the handling of the events. The
events are named "Current" and "Open". The terminology can be confusing at
times, because for example there's an "AfterUpdate" property that deals with
the "AfterUpdate" event. In general, if the event property is named "On
<Something>", then "<Something>" is the name of the actual event. There
are, alas, one or two exceptions to this.
 

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