Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<br />
Combo8.Clear<br />
RES.Open "ATTEND", CON, adOpenDynamic, adLockOptimistic, adCmdTable<br />
    If RES.RecordCount > 0 Then<br />
        RES.MoveFirst<br />
            For i = 0 To RES.RecordCount - 1<br />
                Combo8.AddItem RES.Fields("ANM").Value<br />
                Combo8.ItemData(Combo8.NewIndex) = RES.Fields("AID").Value<br />
        RES.MoveNext<br />
        Next<br />
    End If<br />
RES.Close<br />
End Sub<br />


Will this code help me to load anm(attendant name)as well as aid in single combo box?
Actually I want to show anm(attendant name) in combo8 referencing the aid which is pk of attend tab and fk of another table.
at the time of updating/changing values of anm(attendant name)will it consider aid field.
Means it sh'd change or store aid but only show anm in combo8.............
Please help

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 24-Dec-12 0:31am
v2
Comments
OriginalGriff 24-Dec-12 6:31am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
surkhi 24-Dec-12 6:38am    
Actually I didn't know about this matter. I'll take care of this thing next time.
Thanx
OriginalGriff 24-Dec-12 6:44am    
It's called Netiquette: http://en.wikipedia.org/wiki/Etiquette_(technology)
Ignoring it is the same as going into a restaurant and being rude, loud and abusive to the staff. You won't get served better, but you might get something in your food you didn't ask for, or want...

1 solution

May be following code will help.

If Rs.State = 1 Then Rs.Close
Rs.Open "select distinct(Your_Field) from Your_Table order by Your_Field", Con, adOpenKeyset, adLockPessimistic
            If Rs.RecordCount > 0 Then
                
                Combo1.Clear
                Combo1.AddItem ""
            
                With Rs
                    Do While Not .EOF
                        Combo1.AddItem Rs(0)
                        .MoveNext
                    Loop
                    .Close
                End With
                    
                Combo1.Visible = True
                Combo1.SetFocus
            End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900