PDA

View Full Version : Solved: Strange Combo Box Problem



bopo
01-10-2008, 06:21 AM
Hi

Basically I have a combo box which has a row source to one particular column within a table, I wrote one line of VBA behind the combo box, but it just doesnt work, its so simple and I had no idea why :doh:

Private Sub Combo97_AfterUpdate()
If Combo97.Value = "Single" Then
AccommodationSelected.Value = "Family"
Else
AccommodationSelected.Value = "Noob"
End If
End Sub

Heres the things I have checked


Correct combo box name
Code within the correct event/sub routine
'Single' is spelt correctly in the code and within the record source
The receving text box is splet correctly (know this as noob appears each time I test)If anyone has any other suggestions I would appreciate them :thumb

mattj
01-10-2008, 06:55 AM
Add Debug.Print Me.Combo97 as the first line. Does this actually return the value "Single"?

Matt

bopo
01-10-2008, 08:45 AM
Nope, nothing appears, also the combo box does have other options in apart from single.

mattj
01-10-2008, 08:50 AM
Try

If Me.Combo97 = "Single"

Also, verify that there is only the one column in the row source of the combo box, check the Column Count property, and the Bound Column property...

bopo
01-10-2008, 09:20 AM
Hi

Thanks for the suggestion, I knew there was also the ID, but I unticked that so I didnt think it mattered, anyway I just added .column(1) to it and it works.

Thanks