Please Help!! Refering to Column in combo box using VB

G

Guest

Good Morning,

I have a combo box with a number of columns. Using a command button I want a
message to be displayed if the field in column 4 of the combo box is Null.
For a single column field I had previously used the following VB under the
click event to do this:

If (Nz(Me.WorkInstruction.Value, "") = "") Then
MsgBox "This Job has no Work Instruction.", vbInformation +
vbOKOnly, _
"No Work Instruction"

This worked fine so I have tried to use the following to get the same
result. It doesn't seem to like it!!!!!

If (Nz(Me.WorkInstruction.Column(4).Value, "") = "") Then
MsgBox "This Job has no Work Instruction.", vbInformation +
vbOKOnly, _
"No Work Instruction"

Please help me.... Thanx in advance
 
S

Stefan Hoffmann

hi Ashley,

A. Smart said:
I have a combo box with a number of columns. Using a command button I want a
message to be displayed if the field in column 4 of the combo box is Null.
For a single column field I had previously used the following VB under the
click event to do this:

If (Nz(Me.WorkInstruction.Value, "") = "") Then
MsgBox "This Job has no Work Instruction.", vbInformation +
vbOKOnly, _
"No Work Instruction"

This worked fine so I have tried to use the following to get the same
result. It doesn't seem to like it!!!!!

If (Nz(Me.WorkInstruction.Column(4).Value, "") = "") Then
MsgBox "This Job has no Work Instruction.", vbInformation +
vbOKOnly, _
"No Work Instruction"
The columne count starts at 0 and the Column property returns the value
by it self, there is no Column(4).Value subproperty.

So (Nz(Me.WorkInstruction.Column(4), "") = "") should work.


mfG
--> stefan <--
 
D

Douglas J Steele

Column counts start at 0. As well, I don't believe the Column collection
includes a Value property.

To refer to the 4th column, use Me.WorkInstruction.Column(3)
 

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

Top