Re: Use value of combo box column

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Roger Carlson (NO-Rog3erc-SPAM_at_hotmail.com)
Date: 11/16/04


Date: Tue, 16 Nov 2004 08:27:35 -0500

Combo box columns are indexed starting at zero, so the column numbers for a
3 column combo are 0, 1, 2. Try using 2.

BTW, the condition must be on the same line as the ElseIf:

  ElseIf Me.MyCombo.Column(2)="C" then

-- 
--Roger Carlson
  Access Database Samples: www.rogersaccesslibrary.com
  Want answers to your Access questions in your Email?
  Free subscription:
  http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
"Snowsride" <Snowsride@discussions.microsoft.com> wrote in message
news:FA753C9B-2D4C-4AF3-8B81-8D8776BC13C6@microsoft.com...
> I have a combo box with three columns.
>
> I want an If statement to execute on the value of the contents of column 3
> which contains text C or D.
>
> How can I do this?  I've tried
>
> If Me.MyCombo.Column(3)="D"  then
> TakeSomeAction
> Elseif
> Me.MyCombo.Column(3)="C"  then
> DosomethingElse
> end if
>
> Thanks
>
>


Relevant Pages

  • Re: Use value of combo box column
    ... "Roger Carlson" wrote: ... > BTW, the condition must be on the same line as the ElseIf: ... > Access Database Samples: www.rogersaccesslibrary.com ...
    (microsoft.public.access.formscoding)
  • Re: Validate textboxs with Form BeforeUdate
    ... Private Sub Form_BeforeUpdate ... Cancel = True ... "Zero Not Allowed" ... ElseIf Me.Textbox2.Value = 0 Then ...
    (microsoft.public.access.modulesdaovba)
  • Re: help regarding "if"
    ... zero or one is superior to two, which is seldom the case. ... elseif Oro_kvot>= 2 ...
    (comp.soft-sys.matlab)
  • Re: Solving Triangles
    ... > It is not advisable to test the contents of a Double variable for equality ... the OP's code will throw a "divide by zero" error if Dx is 0: ... ElseIf Dx < 1E-13 Then ... Prev by Date: ...
    (comp.lang.basic.visual.misc)
  • preset range
    ... Rng = Selection.Rows.Count ... with 'the value zero ... ElseIf ActiveCell.Value = "Company" Then ... range of "A8:Z300" as the selection set. ...
    (microsoft.public.excel.programming)