Multiple Text Boxes linked to ComboBox (1 Viewer)

branston

Registered User.
Local time
Today, 09:32
Joined
Apr 29, 2009
Messages
372
Morning All!

This is my 1st post. I have a form with a combo box listing the different status of the form (a, b, or c). I want a different date box to come up for each of the status. I have set up 3 date boxes (A_Date, B_Date, C_Date) in the form and set them all to visible = no. I have the following code and it works perfectly for 1:

If Status = "a" Then
TB1: A_date.Visible = True
A_date.SetFocus
Else
Me.A_date.Visible = False
End If

But i dont seem to be able to alter the code to get it to work for the others. Even if i change the above code to say B_Date rather than A_Date it doesnt seem to like it.

Hopefully I am doing something simple wrong. Any help would be greatly appreciated.

Thank you
 

Dennisk

AWF VIP
Local time
Today, 09:32
Joined
Jul 22, 2004
Messages
1,649
we need to see which event the code you have posted is run from.
 

branston

Registered User.
Local time
Today, 09:32
Joined
Apr 29, 2009
Messages
372
I knew this would happen... As soon as i post a question i figure it out. Its was mainly a fundamental error on my part - I had named the text boxes incorrectly.
Once I had sorted that out i found that the below code allowed me to put more than 1 in:

If Me.Combo39 = "a" Then
Me.A_date.Visible = True
Else
Me.A_date.Visible = False
End If

Thanks anyway.
 

branston

Registered User.
Local time
Today, 09:32
Joined
Apr 29, 2009
Messages
372
Oh, and Dennisk - thank you for your quick reply, as i said before im new to these posts so forgot the vital bit of info! Its run from the After Update event of the combo box, but im also going to put it in the on current event for the form to make sure the correct box shows when the form is 1st laoded.
 

Users who are viewing this thread

Top Bottom