Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: Convert string to integer

Geek News

Convert string to integer
h3llz 12/7/2008 3:19:01 PM
productPrice = Val(txtProductPrice.Caption)

productPrice is dimmed as integer.
txtProductPrice.Caption is £25 and i want to get 25 out of it.
Help please :(
Re: Convert string to integer
Rick Brandt <rickbrandt2[ at ]hotmail.com> 12/7/2008 4:46:42 PM
On Sun, 07 Dec 2008 07:19:01 -0800, h3llz wrote:

[Quoted Text]
> productPrice = Val(txtProductPrice.Caption)
>
> productPrice is dimmed as integer.
> txtProductPrice.Caption is £25 and i want to get 25 out of it. Help
> please :(

productPrice = CInt(Mid(txtProductPrice.Caption,2))


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Re: Convert string to integer
fredg <fgutkind[ at ]example.invalid> 12/7/2008 6:07:39 PM
On Sun, 07 Dec 2008 16:46:42 GMT, Rick Brandt wrote:

[Quoted Text]
> On Sun, 07 Dec 2008 07:19:01 -0800, h3llz wrote:
>
>> productPrice = Val(txtProductPrice.Caption)
>>
>> productPrice is dimmed as integer.
>> txtProductPrice.Caption is £25 and i want to get 25 out of it. Help
>> please :(
>
> productPrice = CInt(Mid(txtProductPrice.Caption,2))

Which leads to the question of why is the poster using a label to
store this gtext value, rather than a text box storing the value as an
integer (or more likely better, as Currency datatype)?
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Re: Convert string to integer
"Damon Heron" <damon_327[ at ]hotmail.com> 12/7/2008 6:23:50 PM
I have a problem with a textbox having a caption. Is txtProductPrice a
label? Anyway,
how about:
productPrice=CCur(txtProductPrice.Caption)

Damon

"Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message
news:S5T_k.8935$x%.1227[ at ]nlpi070.nbdc.sbc.com...
[Quoted Text]
> On Sun, 07 Dec 2008 07:19:01 -0800, h3llz wrote:
>
>> productPrice = Val(txtProductPrice.Caption)
>>
>> productPrice is dimmed as integer.
>> txtProductPrice.Caption is £25 and i want to get 25 out of it. Help
>> please :(
>
> productPrice = CInt(Mid(txtProductPrice.Caption,2))
>
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com


Re: Convert string to integer
h3llz 12/7/2008 6:45:02 PM
thanks

the reason a label is containing the information because when i select a
product then click get product, it will get all product information then i
have a button add ot basket, why do another query to get the product
information when its in a label? =]

"Damon Heron" wrote:

[Quoted Text]
> I have a problem with a textbox having a caption. Is txtProductPrice a
> label? Anyway,
> how about:
> productPrice=CCur(txtProductPrice.Caption)
>
> Damon
>
> "Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message
> news:S5T_k.8935$x%.1227[ at ]nlpi070.nbdc.sbc.com...
> > On Sun, 07 Dec 2008 07:19:01 -0800, h3llz wrote:
> >
> >> productPrice = Val(txtProductPrice.Caption)
> >>
> >> productPrice is dimmed as integer.
> >> txtProductPrice.Caption is £25 and i want to get 25 out of it. Help
> >> please :(
> >
> > productPrice = CInt(Mid(txtProductPrice.Caption,2))
> >
> >
> > --
> > Rick Brandt, Microsoft Access MVP
> > Email (as appropriate) to...
> > RBrandt at Hunter dot com
>
>
>
Re: Convert string to integer
Bob Quintal <rquintal[ at ]sPAmpatico.ca> 12/9/2008 11:51:46 PM
=?Utf-8?B?aDNsbHo=?= <h3llz[ at ]discussions.microsoft.com> wrote in
news:3F15D474-CE80-4647-8659-070B28312A07[ at ]microsoft.com:

[Quoted Text]
> thanks
>
> the reason a label is containing the information because when i
> select a product then click get product, it will get all product
> information then i have a button add ot basket, why do another
> query to get the product information when its in a label? =]
>
The question is about why you retrieve the product information
(using the Get Product Button) in a label instead of a textbox?.
Your method involves much code, as labels have no recordsource
property. If the data were in a textbox, you would have no problem

Q

> "Damon Heron" wrote:
>
>> I have a problem with a textbox having a caption. Is
>> txtProductPrice a label? Anyway,
>> how about:
>> productPrice=CCur(txtProductPrice.Caption)
>>
>> Damon
>>
>> "Rick Brandt" <rickbrandt2[ at ]hotmail.com> wrote in message
>> news:S5T_k.8935$x%.1227[ at ]nlpi070.nbdc.sbc.com...
>> > On Sun, 07 Dec 2008 07:19:01 -0800, h3llz wrote:
>> >
>> >> productPrice = Val(txtProductPrice.Caption)
>> >>
>> >> productPrice is dimmed as integer.
>> >> txtProductPrice.Caption is £25 and i want to get 25 out of
>> >> it. Help please :(
>> >
>> > productPrice = CInt(Mid(txtProductPrice.Caption,2))
>> >
>> >
>> > --
>> > Rick Brandt, Microsoft Access MVP
>> > Email (as appropriate) to...
>> > RBrandt at Hunter dot com
>>
>>
>>
>



--
Bob Quintal

PA is y I've altered my email address.
** Posted from http://www.teranews.com **

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net