Error in Listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, i'm having a problem with my listbox NAMES, i have three columns, the 1st
is the names, 2nd code and 3rd adress, but just the column of names is
showed. to test i put the variables into a msgbox, but just the column 0 and1
are showed, the 3rd is giving an error, like "INVALID USE OF NULL (syntax
error)". the code is like thiis.

For i = 0 To d - 1
b = Me.[Lname].Column(0)
Next i
MsgBox b

For j = 0 To d - 1
c = Me.[Lname].Column(1)
Next j
MsgBox c

For k = 0 To d - 1
a = Me.[Lname].Column(2)
Next k
MsgBox a

Any sugestion, thanks
 
It possible that there is no value in the field, try this

For i = 0 To d - 1
b = Nz(Me.[Lname].Column(0),"")
c = Nz(Me.[Lname].Column(1),"")
a = Nz(Me.[Lname].Column(2),"")
Next i
MsgBox b
MsgBox c
MsgBox a
 
hi, it appear the tree msgbox, but the 3rd(Column2) one it was empty, you
know how can i get the value from the 2nd column?
thanks

"Ofer" escreveu:
It possible that there is no value in the field, try this

For i = 0 To d - 1
b = Nz(Me.[Lname].Column(0),"")
c = Nz(Me.[Lname].Column(1),"")
a = Nz(Me.[Lname].Column(2),"")
Next i
MsgBox b
MsgBox c
MsgBox a

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



Bruno Coelho said:
Hi, i'm having a problem with my listbox NAMES, i have three columns, the 1st
is the names, 2nd code and 3rd adress, but just the column of names is
showed. to test i put the variables into a msgbox, but just the column 0 and1
are showed, the 3rd is giving an error, like "INVALID USE OF NULL (syntax
error)". the code is like thiis.

For i = 0 To d - 1
b = Me.[Lname].Column(0)
Next i
MsgBox b

For j = 0 To d - 1
c = Me.[Lname].Column(1)
Next j
MsgBox c

For k = 0 To d - 1
a = Me.[Lname].Column(2)
Next k
MsgBox a

Any sugestion, thanks
 
I'm not sure that I understand you completely, but if youwant to display
column 2 if column three is empty then use that

Msgbox Nz(Me.[Lname].Column(2),Me.[Lname].Column(1))
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



Bruno Coelho said:
hi, it appear the tree msgbox, but the 3rd(Column2) one it was empty, you
know how can i get the value from the 2nd column?
thanks

"Ofer" escreveu:
It possible that there is no value in the field, try this

For i = 0 To d - 1
b = Nz(Me.[Lname].Column(0),"")
c = Nz(Me.[Lname].Column(1),"")
a = Nz(Me.[Lname].Column(2),"")
Next i
MsgBox b
MsgBox c
MsgBox a

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



Bruno Coelho said:
Hi, i'm having a problem with my listbox NAMES, i have three columns, the 1st
is the names, 2nd code and 3rd adress, but just the column of names is
showed. to test i put the variables into a msgbox, but just the column 0 and1
are showed, the 3rd is giving an error, like "INVALID USE OF NULL (syntax
error)". the code is like thiis.

For i = 0 To d - 1
b = Me.[Lname].Column(0)
Next i
MsgBox b

For j = 0 To d - 1
c = Me.[Lname].Column(1)
Next j
MsgBox c

For k = 0 To d - 1
a = Me.[Lname].Column(2)
Next k
MsgBox a

Any sugestion, thanks
 
Back
Top