getting data from listbox

D

Daniel M

I have a list box that is populated by a query. I then have a check box and
a text box. when the check box is checked i want the contents of the list
box to be put in the text box.

I have:

If Check27 = True Then
[received esn] = [Forms]![incoming]![ESN]
Else
[received esn] = Null
End If


but it does not pull the info from the list box. can anyone tell me why?
 
I

Irshad Alam

Hi,
Try as below, hope it should work :


If Me.Check27 = True Then
Me.[received esn] = Me.[ESN]
Else
Me.[received esn] = Null
End If

But it is always adviseable to put value "0" if Numeric or for Text field
put text "Null", as something should be displayed on the text box, it
benifits the users also when the form is opened later. Its your choice and
requirement.

For any further error, post the error description for further assistance.

Regards.

Irshad
 
D

Daniel M

Still doesnt work? I pasted the code but nothing happens when i check the
box.

I can take my original code and change it to [received esn]=
[forms]![incoming]![received serial] and it works. The only difference i see
in the two controls is that 'received serial' is a text box while 'esn' is a
list box.

Any other ideas? My list box is populated by
SELECT ESN
FROM RMA_LOG
WHERE rma_number=combo4;

If Check27 = True Then
[received esn] = [Forms]![incoming]![ESN]
Else
[received esn] = Null
End If


Irshad Alam said:
Hi,
Try as below, hope it should work :


If Me.Check27 = True Then
Me.[received esn] = Me.[ESN]
Else
Me.[received esn] = Null
End If

But it is always adviseable to put value "0" if Numeric or for Text field
put text "Null", as something should be displayed on the text box, it
benifits the users also when the form is opened later. Its your choice and
requirement.

For any further error, post the error description for further assistance.

Regards.

Irshad




Daniel M said:
I have a list box that is populated by a query. I then have a check box
and
a text box. when the check box is checked i want the contents of the list
box to be put in the text box.

I have:

If Check27 = True Then
[received esn] = [Forms]![incoming]![ESN]
Else
[received esn] = Null
End If


but it does not pull the info from the list box. can anyone tell me why?
 
D

Daniel M

Daniel M said:
Still doesnt work? I pasted the code but nothing happens when i check the
box.

I can take my original code and change it to [received esn]=
[forms]![incoming]![received serial] and it works. The only difference i
see in the two controls is that 'received serial' is a text box while
'esn' is a list box.

Any other ideas? My list box is populated by
SELECT ESN
FROM RMA_LOG
WHERE rma_number=combo4;

If Check27 = True Then
[received esn] = [Forms]![incoming]![ESN]
Else
[received esn] = Null
End If


Irshad Alam said:
Hi,
Try as below, hope it should work :


If Me.Check27 = True Then
Me.[received esn] = Me.[ESN]
Else
Me.[received esn] = Null
End If

But it is always adviseable to put value "0" if Numeric or for Text field
put text "Null", as something should be displayed on the text box, it
benifits the users also when the form is opened later. Its your choice
and
requirement.

For any further error, post the error description for further assistance.

Regards.

Irshad




Daniel M said:
I have a list box that is populated by a query. I then have a check box
and
a text box. when the check box is checked i want the contents of the
list
box to be put in the text box.

I have:

If Check27 = True Then
[received esn] = [Forms]![incoming]![ESN]
Else
[received esn] = Null
End If


but it does not pull the info from the list box. can anyone tell me why?
 

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