Conditionally Clear Contents

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

Guest

Hi all,

I have a combo box on a form. The como box selects a studentID. After
selecting a student the user can then select from a second combo box their
tutor. The form itself is for students to select a test. If the student
wishes to cancel their 'appointment' with a tutor their is a special ID
available in the first combo box, studentID '0'. This returns the text in
the combox box to 'Available'. The student then has to manually clear the
second combo box with the tutors name. Is it possbile to automatically clear
the second combo with the first one states, studentID '0'. I was thinking
along the lines of:

iif(combo1=0, combo2.value="".......)

Any ideas where I would put should code? Onupdate? Many thanks for taking
the time to read this. Any and all help very welcome.

Debbie D. (UK)
 
Hi Debbie, On the after update event of the student you can write the code

If Me.combo1=0 then
me.combo2=Null
End If
 
Ofer,

Good to recieve you very welcome advise once again this week. It worked
great but then I tried it on another combo box in the subform. The only
thing different is that this combo contents are coming from a query behind
the subform. Here is my code, well to be honest its yours ;-) As you can see
tried the column(0) to see if this makes a difference.

Private Sub CustID_AfterUpdate()
If Me.CustID.Column(0) = 0 Then
Me.Note = Null
Me.Module = Null
End If


End Sub

But I get this message ' Runtime error 94' Invalid use of Null
 
If it gives you invalid use of null, so most chance that the type of the
fiels is text, in that case try and change it form
=Null

To
=""
 
Ofer,

My hero, many thanks. Debbie D.

Ofer said:
If it gives you invalid use of null, so most chance that the type of the
fiels is text, in that case try and change it form
=Null

To
=""
 
Back
Top