473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Overworking the expression service?

MLH
MyLogEnt = "New vehicle (VID #" & GetCurrentVehicID() & ") added by "
& CurrentUser()

The expression service obviously handles the coercion of the long
integer returned by GetCurrentVehicID() to a string that is normally
expected in a concat. Just because it works doesn't mean that its
good programming. Am wondering what you think?
Sep 24 '06 #1
9 1335
Access (and VBA) makes implicit type conversions constantly (well -
depending on the dilligence of the developer perhaps).
You'll have to try a lot harder than that to overwork the expression
service.

It would be more explicit to have

MyLogEnt = "New vehicle (VID #" & CStr(GetCurrentVehicID()) & ") added by "
& CurrentUser()

But as I said - that's a development choice.

"MLH" <CR**@NorthState.netwrote in message
news:90********************************@4ax.com...
MyLogEnt = "New vehicle (VID #" & GetCurrentVehicID() & ") added by "
& CurrentUser()

The expression service obviously handles the coercion of the long
integer returned by GetCurrentVehicID() to a string that is normally
expected in a concat. Just because it works doesn't mean that its
good programming. Am wondering what you think?

Sep 24 '06 #2
"Good programming" is likely to evoke opinions--which may well be what
you want.

Coding is a means to me, not an end. So in this case, I seldom
explicitly convert to a string. If I want something to be formatted,
yes. If I want to be sure there is no extra space, I mostly use Format()
without format string.

But Cstr() only takes a little extra time here, without supplying value.
Maybe, all this said, leaving the expression as is is the best.

MLH schreef:
MyLogEnt = "New vehicle (VID #" & GetCurrentVehicID() & ") added by "
& CurrentUser()

The expression service obviously handles the coercion of the long
integer returned by GetCurrentVehicID() to a string that is normally
expected in a concat. Just because it works doesn't mean that its
good programming. Am wondering what you think?
--
Bas Cost Budde
Holland
Sep 25 '06 #3
Bas Cost Budde <b.*********@dev.null.comwrote in
news:ef**********@localhost.localdomain:
"Good programming" is likely to evoke opinions--which may well be
what you want.

Coding is a means to me, not an end. So in this case, I seldom
explicitly convert to a string. If I want something to be
formatted, yes. If I want to be sure there is no extra space, I
mostly use Format() without format string.

But Cstr() only takes a little extra time here, without supplying
value. Maybe, all this said, leaving the expression as is is the
best.
I think it's always best to explicitly coerce values:

1. if you don't, the results may be unexpected (though string
coercion is probably the safest of all).

2. you're dependent on changes in behavior of the way coercion may
work in the same code run on future versions of VB.

3. explicit coercion shows that you've considered what's going on,
and makes the code easier for another programmer to read.

4. having a policy of explicit coercion makes you think more about
implicit coercion and, in my opinion, makes you a better coder for
doing that extra thinking -- you're more likely to catch possible
errors if you're in the habit of never depending on implicit
coercion.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Sep 25 '06 #4
MLH wrote:
MyLogEnt = "New vehicle (VID #" & GetCurrentVehicID() & ") added by "
& CurrentUser()

The expression service obviously handles the coercion of the long
integer returned by GetCurrentVehicID() to a string that is normally
expected in a concat. Just because it works doesn't mean that its
good programming. Am wondering what you think?
I think that all data are strings.

Sep 25 '06 #5

Lyle Fairfield wrote:
MLH wrote:
MyLogEnt = "New vehicle (VID #" & GetCurrentVehicID() & ") added by "
& CurrentUser()

The expression service obviously handles the coercion of the long
integer returned by GetCurrentVehicID() to a string that is normally
expected in a concat. Just because it works doesn't mean that its
good programming. Am wondering what you think?

I think that all data are strings.
As a general rule, I try to get someone else to do my thinking for me.
Takes too much effort to figure things out on my own.

Sep 26 '06 #6
"Lyle Fairfield" <ly***********@aim.comwrote
I think that all data are strings.
Ah, "string theory." I didn't know you were a physicist, Lyle.

Larry
Sep 26 '06 #7

Larry Linson wrote:
"Lyle Fairfield" <ly***********@aim.comwrote
I think that all data are strings.

Ah, "string theory." I didn't know you were a physicist, Lyle.

Larry
You could just string along with what I said then, Larry.

Sep 27 '06 #8
I do play some string instruments, though. I didn't realize until now I
could rely on implicit coercion, playing the base :)

--
Bas Cost Budde
Holland
Sep 27 '06 #9
Bas Cost Budde wrote:
I do play some string instruments, though. I didn't realize until now I
could rely on implicit coercion, playing the base :)
I play only with g-strings. I hope there is no coercion, implicit or
otherwise.
But more often than not I don't get to first base at all.

Sep 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Tina Li | last post by:
Hello, I've been struggling with a regular expression for parsing XML files, which keeps giving the run time error "maximum recursion limit exceeded". Here is the pattern string: ...
2
by: Sharon | last post by:
I've had an Access 2000 app running successfully for many months on both Windows XP and Windows 2000. Recently when my Windows 2000 users call a particular report, they get first a dialog...
5
by: deko | last post by:
After developing an MDB in Access 2003 on WS03, then making it into an MDE and deploying it on a WinXP box with Access 2003 installed, I get this error: Function is not available in expressions...
5
by: JIM.H. | last post by:
Hello, I have this validation expression: ^(?:(?:0?|1)|(?:0?|11)(?!\/31)|(?:0?2)(?:(?!\/3|\/29\/(?:(?:0||)00|(?:\d{2}(?:0||))))))\/(?:0?||3)\/\d{4}$ This is supposed to match MM/DD/YYYY it is...
4
by: bleighfield | last post by:
Hi everyone Hope someone can help with this one.. Background: I work in vehicle fleet, I have built something to 'predict' when a car/van service is due (it's fairly simple, calculates...
9
by: Earl | last post by:
I have somewhat of an interesting scenario: The form allows the user to select a service, which populates a a grid of product information related to that service ("service grid"). The user can...
5
by: shawnmkramer | last post by:
Anyone every heard of the Regex.IsMatch and Regex.Match methods just hanging and eventually getting a message "Requested Service not found"? I have the following pattern: ^(?<OrgCity>(+)+),...
4
by: TC | last post by:
I've used Access for a while, so I know that Access queries which use VBA functions or custom functions cannot be evaluated from outside Access. This was never a problem for me before, but it is a...
2
by: rmmahara | last post by:
Hi Folks, I've been reading these forums for a while and now I'm in desperate need of help, so I thought I'd post! Background: I'm creating a Service Dashboard to track my team's adherence...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.