Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking a value on listbox, but not working 1

Status
Not open for further replies.

macca007

Programmer
May 1, 2004
86
GB
Hi all,

I have this code which checks the value on the listbox if true then it will display msg, if false will also display msg with different txt.

If Me.lstClinicalDetails.Column(5) = "avm" Then
' Me.TrigemRC.Enabled = True
MsgBox "trigem"
Else
' Me.TrigemRC.Enabled = False
MsgBox "not trigem"
End If

The problem is if it is avm it still display "not trigem".

cheers
 
Thanks for the reply,

but removing the speech marks gives me an error saying variable not defined.

Any other suggestions?
 
Perhaps this ?
If LCase(Trim(Me!lstClinicalDetails.Column(5))) = "avm" Then

To be sure, you may put this instruction before the If:
MsgBox "'" & Me!lstClinicalDetails.Column(5) & "'"

BTW, Column(5) is the 6th column.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
cheers tried a different code at the end

If Not IsNull(DLookup("Pathology", "Treatment", "Hosp_No = '" & Hospital_no & "' And Pathology = 'Trigeminal Neuralgia'")) Then

which worked.

I also tried phv's solution and worked also!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top