text box format

R

Rpettis31

I have set a few text box set to some values on a list box based on the user
selection. However the text box is not showing the correct format. The list
box column value is correct. The properties on the text box are set to
currency but the value in the text box does not display correctly?
 
K

KARL DEWEY

but the value in the text box does not display correctly?
No idea what to suggest as I can not see what it is displaying.
 
R

Rpettis31

The value is correct but the format is not correct the properties show as
Currency the list box value is currency yet this displays in a non currency
format.

Listbox value will show $10.89 and the text boxt will show 10.89112
 
K

KARL DEWEY

Did you set the text box format? Formats do not carry through unless it
changes the data to text.
 
R

Rpettis31

The properties of the text box are set as currency. The control source is set
up on the listbox to a column. I have tried to format the text box in code
 
B

Beetle

Try this in the Control Source of the text box;

=CCur([lstItem].Column(2)

substituting the appropriate column number of course.

Another option would be;

=Format([lstItem].Column(2), "$##.##")
 
B

Beetle

Correction. That should be;

=CCur([lstItem].Column(2))

(forgot the closing parentheses in my first post)
 
K

KARL DEWEY

The control source is set up on the listbox to a column.
I am not following you.
Do you mean that the text box gets the data form a list box?
Why do you need a list box and a text box, both with the same information?
Are you picking prices or something?
Seems like just the list box would do.
 
R

Rpettis31

Since the text box are not filled until the click event how do I get rid of
the #error that is prefilled in the text box?

Beetle said:
Correction. That should be;

=CCur([lstItem].Column(2))

(forgot the closing parentheses in my first post)

--
_________

Sean Bailey


Rpettis31 said:
The properties of the text box are set as currency. The control source is set
up on the listbox to a column. I have tried to format the text box in code
 
B

Beetle

Just put the Column references directly in the Control Source
of each text box. There's no need to use the Click event at all
(at least not for this purpose).

--
_________

Sean Bailey


Rpettis31 said:
Since the text box are not filled until the click event how do I get rid of
the #error that is prefilled in the text box?

Beetle said:
Correction. That should be;

=CCur([lstItem].Column(2))

(forgot the closing parentheses in my first post)

--
_________

Sean Bailey


Rpettis31 said:
The properties of the text box are set as currency. The control source is set
up on the listbox to a column. I have tried to format the text box in code
on the list box click event to display the correct format?

:

Did you set the text box format? Formats do not carry through unless it
changes the data to text.

:

The value is correct but the format is not correct the properties show as
Currency the list box value is currency yet this displays in a non currency
format.

Listbox value will show $10.89 and the text boxt will show 10.89112

:

but the value in the text box does not display correctly?
No idea what to suggest as I can not see what it is displaying.

:

I have set a few text box set to some values on a list box based on the user
selection. However the text box is not showing the correct format. The list
box column value is correct. The properties on the text box are set to
currency but the value in the text box does not display correctly?
 
R

Rpettis31

There is nothing selected on the list box when the form loads so the text box
has a #error in it. I have tried to do an nz(CCur(me.lstItems.column(3)),0)
but that does not work.

Beetle said:
Just put the Column references directly in the Control Source
of each text box. There's no need to use the Click event at all
(at least not for this purpose).

--
_________

Sean Bailey


Rpettis31 said:
Since the text box are not filled until the click event how do I get rid of
the #error that is prefilled in the text box?

Beetle said:
Correction. That should be;

=CCur([lstItem].Column(2))

(forgot the closing parentheses in my first post)

--
_________

Sean Bailey


:

The properties of the text box are set as currency. The control source is set
up on the listbox to a column. I have tried to format the text box in code
on the list box click event to display the correct format?

:

Did you set the text box format? Formats do not carry through unless it
changes the data to text.

:

The value is correct but the format is not correct the properties show as
Currency the list box value is currency yet this displays in a non currency
format.

Listbox value will show $10.89 and the text boxt will show 10.89112

:

but the value in the text box does not display correctly?
No idea what to suggest as I can not see what it is displaying.

:

I have set a few text box set to some values on a list box based on the user
selection. However the text box is not showing the correct format. The list
box column value is correct. The properties on the text box are set to
currency but the value in the text box does not display correctly?
 
B

Beetle

You can use the forms Open event to force the first item
in the list box to be preselected.

Private Sub Form_Open (Cancel As Integer)

Me!lstItem = Me!lstItem.ItemData(0)

End Sub

Karl does bring up a good point though. Is there a reason you don't
just display all this in the list box itself?

--
_________

Sean Bailey


Rpettis31 said:
There is nothing selected on the list box when the form loads so the text box
has a #error in it. I have tried to do an nz(CCur(me.lstItems.column(3)),0)
but that does not work.

Beetle said:
Just put the Column references directly in the Control Source
of each text box. There's no need to use the Click event at all
(at least not for this purpose).

--
_________

Sean Bailey


Rpettis31 said:
Since the text box are not filled until the click event how do I get rid of
the #error that is prefilled in the text box?

:

Correction. That should be;

=CCur([lstItem].Column(2))

(forgot the closing parentheses in my first post)

--
_________

Sean Bailey


:

The properties of the text box are set as currency. The control source is set
up on the listbox to a column. I have tried to format the text box in code
on the list box click event to display the correct format?

:

Did you set the text box format? Formats do not carry through unless it
changes the data to text.

:

The value is correct but the format is not correct the properties show as
Currency the list box value is currency yet this displays in a non currency
format.

Listbox value will show $10.89 and the text boxt will show 10.89112

:

but the value in the text box does not display correctly?
No idea what to suggest as I can not see what it is displaying.

:

I have set a few text box set to some values on a list box based on the user
selection. However the text box is not showing the correct format. The list
box column value is correct. The properties on the text box are set to
currency but the value in the text box does not display correctly?
 

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