"%" character

I am using the following code:

Val(strValue)
 
where strValue = "0.1%"

I am getting a type mismatch error.. what does the "%" character do to a 
string?
0
Utf
6/4/2010 11:42:21 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
700 Views

Similar Articles

[PageSpeed] 52

As you found, Val() can't handle strings that are formatted with characters 
such as % or $. Divide the value by 100, i.e. use:
    0.001

In what context do you need such a value entered? If it is an unbound text 
box, set its Format property to Percent, and it will be understood correctly 
as a numeric value.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Wavequation" <Wavequation@discussions.microsoft.com> wrote in message 
news:31D8D7B4-4C76-4C0C-8FDE-DA313AF19D51@microsoft.com...
> I am using the following code:
>
> Val(strValue)
>
> where strValue = "0.1%"
>
> I am getting a type mismatch error.. what does the "%" character
> do to a string? 

0
Allen
6/5/2010 1:57:11 AM
Reply:

Similar Artilces:

Characters /r/n%20%20 in blank tags?
Hi! I have a Webservice which returns an XMLDocument type. In viewing the raw output steam, I noticed that if a tag value is blank, the data stream actually looks like this: <MyTag>\r\n </MyTag>. A CR/LF followed by two spaces. I have a special client to recieve this stream generally, but when I do testing just with IE I note that the formating of such blank tag fields is abbreviated -- perhaps this is something that was purposely designed to make browser output look clearer. But my question is this -- can I suppress this behavior? Best Harry * Harry Whitehouse w...

"%" character
I am using the following code: Val(strValue) where strValue = "0.1%" I am getting a type mismatch error.. what does the "%" character do to a string? As you found, Val() can't handle strings that are formatted with characters such as % or $. Divide the value by 100, i.e. use: 0.001 In what context do you need such a value entered? If it is an unbound text box, set its Format property to Percent, and it will be understood correctly as a numeric value. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http...

hiding % characted in the Y axis using custom format
Few weeks ago I have seen a presentation where by using custom format it was possible to format the Y axis so that it was displaying the % only next to 100 and all the rest of the axis was displaying numbers without %. It was like 100% 80 60 40 20 0 I do not remember the syntax of this custom format. Can someone refresh my memory ? How it was done ? Regards Tony Sounds like someone but a textbox over the 100 to make it 100% best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "Tony" <Tony@discussions.microsoft.com> wrote in message news:E...

DataSet.ReadXml fails when a percentage (%) sign is in the filename followed by 2 hex characters
Using C# in .Net 2003, DataSet.ReadXml fails when a percentage (%) sign is in the filename followed by 2 hex characters. Seems that the % sign is likely encoding the following 2 hex characters. So c:\test%ab.xml fails for ReadXml since %ab is interpreted as 171 and c:\test171.xml does not exist. There is no problem with c:\test%mn.xml because "mn" is not a hex code. If I replace the % sign with %25 (25hex = 37dec = ascii code for %), the ReadXml function succeeds since it is interpreted as c:\test%ab.xml. So I had to write a workaround function to read a filename, replace any ...