Check box column check..

empyrean

Registered User.
Local time
Today, 05:00
Joined
Oct 20, 2009
Messages
17
List box column check..

In my code when i use itemdata (int Y) its checking my second column where my alias information is there but i wanted it to check with first column. If i change the way it adds to columns i.e entering alias in first column. it checks and give me duplicate message but i dont want to exchange the columns.

This is a form in access 2003 and VBA is used for this


Code:
Private Sub CommandResult_Click()
Dim intY As Long
    
    '~~> Loop through List
    For intY = 0 To ListAliasInformation.ListCount - 1
        '~~> Check if Combo Value exists in list
        If ListAliasInformation.ItemData(intY) = ComboCheck.Value Then
            '~~> If found, Inform User
            MsgBox ComboCheck.Value & " Already Exits in list"
            'duplicate = True
            Exit Sub
          
          End If
    Next intY
    '~~> Add Item to List
  Me.ListAliasInformation.AddItem (Me.ComboCheck.Value & ";" & Me.ListAlias.Value )
  
End Sub
 
Last edited:
Try

ListAliasInformation.Column(x, intY)

Where x is the desired column (0 from the sound of it).
 
Do i need to keep X value in loop? i declared x to 0 but its giving error saying "wrong number of arguments or invalid property assignment"
 
If you want the first column, try

ListAliasInformation.Column(0, intY)
 
I am getting the same error saying wrong number of arguments assigned.
 
On that line? What's the full code now?
 
At .itemsdata(0,inty) i am getting that error. Thanks for helping me..


Code:
Private Sub CommandResult_Click()
Dim intY As Long
  
    '~~> Loop through List
    For intY = 0 To ListAliasInformation.ListCount - 1
     
        '~~> Check if Combo Value exists in list
        If ListAliasInformation.ItemData(0, intY) = ComboCheck.Value Then
            '~~> If found, Inform User
            MsgBox ComboCheck.Value & " Already Exits in list"
            'duplicate = True
            Exit Sub
          
          End If
    Next intY
    '~~> Add Item to List
  Me.ListAliasInformation.AddItem (Me.ComboCheck.Value & ";" & Me.ListAlias.Value)
  
End Sub
 
Note that you're using the ItemData property; I used the Column property.
 
yeah my bad... i didnot see it properly. It worked the way i wanted.

Thank you so much pbaldy.

have a nice day
 
No problemo, and you too!
 

Users who are viewing this thread

Back
Top Bottom