empty listbox

C

contato

I use this for populate a listbox

Me.Lista69.RowSource = "select idvenda,codigo,produto,qtd,unit,total from
tbvenda WHERE nvenda like " & nven & " "
Me.Lista69.Requery

when the select is empty or not found any result how i show a msgbox with
mesagge " PRODUCT NOT FOUND"
 
U

UpRider

Contato,
After the .requery line, add:
if lista69.listcount = 0 then
msgbox "list is empty"
exit sub '<or function>
endif

If you want to find the number of hits before you resource the listbox, put
this before your code:

if Dcount("idvenda","tbvenda","idvenda= " & nven) = 0 then
msgbox "no matches for this vendor"
exit sub ' or function
endif
(above assumes nven is a number representing idvenda.)

HTH, UpRider
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top