hello all, i really hope you can help me.
im trying to get a list of customers which are in my database to show up in a combo box but with the code i currently have, it only shows the last record that was entered

rs.MoveLast
With Me.Combo1
.Clear
Do
.AddItem rs.Fields("CustomerFirstName")
rs.MoveNext
Loop Until rs.EOF
End With

under form load^^
using sql
thanks, much help would be appreciated

Recommended Answers

All 5 Replies

Do Until rs.EOF = True
    Combo1.AddItem rs!CustomerFirstName
    rs.MoveNext
Loop
commented: agree +8

@saddas
if you use rs.MoveLast

you will always get only one (the last) record.

commented: you right, i'm forget to explain about move.last :) +7

thanks for response but when i try that code, is says "invalid use of null". do i put the code under form load?

i have tried changing it to movefirst and various other things but still does not work

dont worry solved it myself, i stupidly had movefirst when i click save and that created a blank line in the database

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.