Implicit type conversion

In Access 97, Access would perform implicit conversion of data in a text box 
to, e.g., a Currency when used in an expression like so:

    If txt_price > txt_sellprice Then

However, in Access 2003 this test doesn't perform as expected unless I 
explicitly cast the text box value to Currency, like so:

    If CCur(txt_price) > CCur(txt_sellprice) Then

Is there a setting or option somewhere that governs this behavior? Or am I 
going to have to go through my entire app looking for expressions like this 
and explicity casting them? 


0
Ron
8/27/2007 10:34:36 PM
access 16762 articles. 3 followers. Follow

2 Replies
543 Views

Similar Articles

[PageSpeed] 25

"Ron Hinds" <billg@microsoft.com> wrote in message 
news:%23A4afpP6HHA.3900@TK2MSFTNGP02.phx.gbl...
> In Access 97, Access would perform implicit conversion of data in a text 
> box to, e.g., a Currency when used in an expression like so:
>
>    If txt_price > txt_sellprice Then
>
> However, in Access 2003 this test doesn't perform as expected unless I 
> explicitly cast the text box value to Currency, like so:
>
>    If CCur(txt_price) > CCur(txt_sellprice) Then
>
> Is there a setting or option somewhere that governs this behavior? Or am I 
> going to have to go through my entire app looking for expressions like 
> this and explicity casting them?


I not aware that there was a change in this behaviors/regards. However, if 
you are using un-bound text boxes, then they tend to take on the type that 
they are FIRST set to (they are thus "variant" types).

If both of those text boxes are bound, then I can't possible see the need to 
"cast" the data type as your 2nd example shows.

So, no, there is no global setting, but I am not aware that things changed 
from 97 to a2003 in this regards at all....

I am guessing, but if those text boxes are un-bound, then you have to setup 
a default value for them...perhaps even use code to stuff in a value of zero

me.txt_price = ccur(0)

The text boxes will be of type varient if they are un-bound.

-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com


0
Albert
8/28/2007 3:07:03 AM
"Albert D. Kallal" <PleaseNOOOsPAMmkallal@msn.com> wrote in message 
news:uecCECS6HHA.5740@TK2MSFTNGP04.phx.gbl...
> "Ron Hinds" <billg@microsoft.com> wrote in message 
> news:%23A4afpP6HHA.3900@TK2MSFTNGP02.phx.gbl...
>> In Access 97, Access would perform implicit conversion of data in a text 
>> box to, e.g., a Currency when used in an expression like so:
>>
>>    If txt_price > txt_sellprice Then
>>
>> However, in Access 2003 this test doesn't perform as expected unless I 
>> explicitly cast the text box value to Currency, like so:
>>
>>    If CCur(txt_price) > CCur(txt_sellprice) Then
>>
>> Is there a setting or option somewhere that governs this behavior? Or am 
>> I going to have to go through my entire app looking for expressions like 
>> this and explicity casting them?
>
>
> I not aware that there was a change in this behaviors/regards. However, if 
> you are using un-bound text boxes, then they tend to take on the type that 
> they are FIRST set to (they are thus "variant" types).
>
> If both of those text boxes are bound, then I can't possible see the need 
> to "cast" the data type as your 2nd example shows.
>
> So, no, there is no global setting, but I am not aware that things changed 
> from 97 to a2003 in this regards at all....
>
> I am guessing, but if those text boxes are un-bound, then you have to 
> setup a default value for them...perhaps even use code to stuff in a value 
> of zero
>
> me.txt_price = ccur(0)
>
> The text boxes will be of type varient if they are un-bound.
>
> -- 
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com

Thanks - they are in fact unbound so I'll give that a try.


0
Ron
8/28/2007 3:51:31 AM
Reply:

Similar Artilces:

Access2.0 to Access7.0 conversion
hi i m doing a project in migrating Access2.0 to access7.0. i just created a database in Access7.0 using VisDatamanager in VB6.0. then i exported all the tables in my Access2.0 to access7.0 database. is this enough? will the indexes of 2.0 hold good for 7.0. and if there is any other way pls let me know it. the front end i use is VB6. thank u. gautham The indexes and relations should convert successfully. Here's an old list of issues betweeen Access 2 and later versions: http://allenbrowne.com/gotcha27.html -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Acc...

Resource Type Cost: why its cost does not appear in actual cost?
Hello! 1. We have defined a resource type cost in the resource sheet 2. We have assigned its cost on a project task using Tools / Assign Resources 3. We started the project and at some point the project task containing this cost resource was completed. Problem: Although the task is completed, the cost of the resource type cost assigned to it does not appear in the actual cost. We are using MSP 2007. Thank you very much for your help explaining us why this happens. Regards, Ana Ana -- To status an Expense Cost resource, you need to manually enter the actual expenditure...

How to disable the "implicit mx record" in Exchange
I am having a problem with exchange sending to hosts in recipient domains where these hosts are not actually mail servers. After a lot of review of the SMTP logs, I realized that sometimes Exchange is sending to the correct MX record host, and sometimes it is sending to the host with the A record for the actual domain. When I say the record for the domain, I mean an A record that refences the bare domain name rather than an individual host in the domain. So when Exchange gets a DNS timeout looking up an MX record, it falls back to sending to the domain A record. This causes an immed...

what other ways to get a picture or diagram of types of bacteria
i need pictures of ifferent types of bacteria for an assignment does any one have any or know where i can download some from ...

HTML to XML conversion #2
Hi, I'm trying to create a Learning Object Repository to store learning objects (obviously!). My question is how do I convert HTML pages to XML and then store them in a database and then generate HTML/XHTML pages on the fly and display it to the client from the stored XML files. Help! GeRmIc wrote: > I'm trying to create a Learning Object Repository to store learning objects > (obviously!). My question is how do I convert HTML pages to XML and then > store them in a database and then generate HTML/XHTML pages on the fly and > display it to the client from the st...

XmlSerializer and unknown types
Greetings, I'm using XmlSerializer to read XML file into an object. XML file can have the following contents: .... <properties xsi:type="MyType"> <file-path>../../work</file-path> </properties> ... If "MyType" is not registered with XmlSerializer then during a deserializtion process an exception occurs (System.InvalidOperationException - "The specified type was not recognized..."). I was wondering if I can make XmlSerializer to skip elements it can not recognize either by providing extra attributes to properties of my classes, or...

cell format, custom type: mmm-yy; working with
A cell is referenced in an equation. That cells format contains a custom type: mmm-yy. How does a vba function work with that generally? Is it a string to be chopped up and worked with, or can you use some object property to get at the value or month and year? Cate, If you want to use the formatted value of the cell, you need to use the ..Text property of the range object For example: Sub Test() Dim myC As Range Set myC = ActiveCell With myC .Value = Now MsgBox CDbl(.Value) & " is the cell's underlying number value" .NumberFormat = "mmm-yy" ...

Enumerated type in Dexterity?
I have searched and could not find an answer to this seemingly simple question. Is there such a thing as an enumerated type in Dexterity? If not an explicit one, is there a workaround (with drop down list perhaps?) to get the same kind of functionality as one would expect in an enumerated type? I know I could just create constants to handle this, but I'm trying to avoid adding dozens of constants for this. Thanks -Greg M No, there are no enumerated types in Dexterity. A drop-down list won't help you, because its value is an integer. You will have to create constants for the...

Publisher changes file types
When I installed Publisher it change all my photographic files from Photoshop types to microsoft imaging types which means I can no longer open them in Photoshop by double clicking. How can I change them back? tess "nelltess" <nelltess@discussions.microsoft.com> wrote in message news:2449A445-F9C9-4FEF-9BA2-6FEE8723223E@microsoft.com... > When I installed Publisher it change all my photographic files from > Photoshop types to microsoft imaging types which means I can no > longer open them in Photoshop by double clicking. How can I > change them back? It hasn&#...

Adding support for mfc / atl types in a Win32 project
MSDN says this about adding support for classes shared between atl & mfc (I'm just after points and rects btw)... just add the header ( atltypes.h ). I'm getting linker errors for these classes though. Is there a lib I need to add? Any screwy build options need changing? It's in VC 2003. In the project wizard I note that atl and mfc support aren't available when creating an empty Win32 application. Ta. On 26 May 2006 07:42:09 -0700, Simon L wrote: > MSDN says this about adding support for classes shared between atl & > mfc (I'm just after points and rect...

Type Farsi
I want type farsi in to office word into mac, but I can't. why? ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/community/en-us/default.mspx?mid=651f41a1-1570-48e3-a655-7685e0cad512&dg=microsoft.public.word.docmanagement ...

Auto date conversion
I am trying to type the number 1-2130 into an Excel spreadsheet, but it automatically turns it into Jan-30 every time. I've looked all over for a way to disable it, does anybody know which option toggles this automatic correction? It happens in both Excel 2003 and 2007. Aaron Preformat the cell as Text, or put an apostrophe (') as the first character of your entry to bypass XL's input parser. There's no toggle, it's just the way the parser operates. In article <evmxazigHHA.596@TK2MSFTNGP06.phx.gbl>, "Aaron Stamboulieh" <flamemoth@newsgroup.no...

Implicit linking
MSDN documentation says a lot of symbols/functions/etc have a link library "coredll.lib." One such example would be pOEMLoadInit (http:// msdn.microsoft.com/en-us/library/ee478155.aspx). To use this variable, it only needs to be declared as an extern. I'm assuming this means that it is linked to kern.exe through one of the .lib files contained in the TARGETLIBS list for the kern.exe sources file. The explicit "coredll.lib" is not in this TARGETLIBS list. How do I figure out which actual library the variable belongs to? ...

Typing in word my pages don't show
If I'm typing a WORD document the second page does not show up on the screen unless I put a manual page break in. The second page is there and is created but is just not displayed. Of course putting manual page breaks in is frustrating if you are editing the document a lot. Any clues? I am using Microsoft Office 2007 in Normal view. Please HEEEEELLLLLLLLLPPPP If by Normal view you mean Draft view, then you will not see page breaks unless you display nonprinting characters. But I suspect that you mean you are working in Print Layout view (you would see the second page in Draft...

mfc and type libraries
Hi, If I use the wizard to add some classes from a typelib (for excel) in an mfc dialog based application, I have no problems in visual studio 2003.NET. If I do exactly the same in visual studio 2005 I get a lot of compiler errors. I figured out that the difference is in the generated headerfiles (CWorksheets.h, CWorkbook.h etc.). What do I wrong in visual studio 2005? The generated files from studio 2005 are all using the #import directive (which is causing the errors in my opinion). Why are these not used in the generated files within studio 2003? TIA, Frank ...

RMS & SBA chart of accounts mismatch types.
I'm not sure if anyone else has had this particular problem, but the way SBA sets up Inventory in chart of accounts as an "Inventory Asset" is correct, and pretty standard. I set up the RMS Connector for RMS and when it attempts to map accounts, it will not recognize an "Inventory Asset" account. It creates and "Inventory-POS" Other Current Asset account. Is there a way to change the account type after the fact? It is posting my inventory reductions into the POS account it created rather than the original Inventory account already set up. ...

Possible to chart data for dates implicit within a range?
I have a list of computer programs with start and end dates for each. I need to determine how many programs were running on my system on any given day. Can I get this data for individual days between the start and end dates without creating columns for each intermediate day? Ex.: Program 1 ran from 01/01/2005 to 01/14/2005. Program 2 ran from 01/06/2005 to 01/22/2005. Is it possible to chart the total number of programs running on 01/08/2005 without manually creating a column for that date? Thanks, Nechama You can compute this with formulas. Star with data in A1:C4 as follows: ...

when typing a number automatically reduce the th or st or rd
How would I ,when typing a number automatically, reduce the th or st or rd? Like in Word Format AutoFormat Options AutoFormat Replace Tab Ordinals (Replace (1st) with Superscript -- Don Vancouver USA "jeribelle" <jeribelle@discussions.microsoft.com> wrote in message news:CBE5E55F-C51A-46FF-BD89-CD4241264E2B@microsoft.com... > How would I ,when typing a number automatically, reduce the th or st or > rd? > Like in Word Not a Publisher option... -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msaue...

file conversion
i have an old spreadsheet program called supercalc. is the anyway to convert this over to excel? Hi if you still have the old application this may be able to save your file as *csv or ASCII file? -- Regards Frank Kabel Frankfurt, Germany lexmanc21 wrote: > i have an old spreadsheet program called supercalc. > is the anyway to convert this over to excel? I've never tried it, as I don't have any supercalc files........but you might consider trying to convert it through MSWord, and then into Excel........might be able to only get data without formulas anyway.......... Vaya c...

Restrict entry types
Hi, I have (rather stupidly) put myself up to whip up a spreadsheet for work which is due to be unveiled at a meeting this morning. there are a few things which i'm struggling on, although i'm certain they are relativley simply to implement. 1. I need to restrict the date entry so that it views with /slahes as apposed to anything else. So even if someone inputs 29.11.05 it will automatically default to 29/11/2005 2. Similar problem with the time i need the time to default to 12:00 as opposed to 12.00 or any other value This is because they are going to be exported into a database a...

auto fill in when you type the email address
This is a multi-part message in MIME format. ------=_NextPart_000_097A_01C68E3C.3C6C99D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable anybody know what file on the Outlook client resides data for auto = fill-ins when you start typing the first few letters of an email address = or name of a person? i'm seeing an issue (dunno if it's an issue even) where sometimes the = email addresses of a long time would suddenly disappear? what processes = controls the 'cleansing' of such thing? R Green ------=_NextPart_000_097A_01C...

why is the font so large when I type messages? how can I change
All of a sudden when I type my messages in OUtlook the font is very large and I cannot change it. I do nto know how it happend. Can anyone tell me how to get it back to normal please? I was told that the receiver sees the message in normal size font. thanks Jennie Have you checked your zoom level already? http://www.msoutlook.info/question/95 -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers ---...

Default Data Type for TXT and CSV files
Hi All, When I open a .csv or .txt file in excel the default data type is General (radio button). Is there a way in Excel to change that as Text for all the columns? Thanks in advance Narayanan Sankaranarayanan See one reply to one of your other posts. Narayanan Sankaranarayanan wrote: > > Hi All, > > When I open a .csv or .txt file in excel the default data type is General > (radio button). > Is there a way in Excel to change that as Text for all the columns? > > Thanks in advance > > Narayanan Sankaranarayanan -- Dave Peterson ec35720@msn.com ...

Custom fields showing as Number type in Crystal but Picklist in CRM
I've just installed Crystal Reports (9.2.2) and connected it to my CRM 1.2 database. I notice that custom fields I've added as Picklist type fields in CRM are appearing as Number type fields in Crystal, and therefore showing a number (eg 3) rather than the expected picklist item (eg 'Mobile'). Any ideas? Picklist values are stored in the StringMap table "Roger Strain" <roger@liquidthought.co.za> wrote in message news:4f36724f.0408191103.588694a5@posting.google.com... > I've just installed Crystal Reports (9.2.2) and connected it to my CRM > 1.2 da...

CMOS Battery Type
Could anyone assist, I wish to make sure I get correct replacement CMOS battery before I remove old one. My board is ECS Sis 735KS5A Is there a reference chart available please, unless you know type. Thank You Roger in UK. "Roger" <Monkey@Zoo.fsnet.co.uk> wrote in message news:Oeihamo#KHA.3704@TK2MSFTNGP05.phx.gbl... > Could anyone assist, I wish to make sure I get correct replacement CMOS > battery before I remove old one. My board is ECS Sis 735KS5A Is there a > reference chart available please, unless you know type. > > Thank You ...