[quote=318044:@Dave S]While it worked out for you this time, I highly suggest that you be careful about this practice in the future. Many of us will answer your question with code that ILLUSTRATES the proper procedure, but the “code” may not fit your specific circumstance, or may infact be only “psuedo” code. I would invest the time to figure out what the code does, by either comparing it to information in the LR, or asking pointed questions.
On the subject of Date/Time formats… be aware that the user can CHANGE the system level formats, and if your code “assumes” it to be a particular way, it may not be so.[/quote]
Thanks for your advice Dave and to everyone’s input.
I don’t make it a habit of cut/pasting code. If I do, I check it, and work out best I can, what parts are relevant to “my” software solution.
I like the code that Cho has written, perhaps a bit verbose but that exactly suits my programming style. I do understand how it works.
eg, in general:
[quote]dt is a new instance of Date
d = dt.DayOfWeek returns an integer between 1 and 7
Using the MID function, the string “SunMonTueWedThuFriSat” is evaluated
(d*3) multiplies 3 by the DayOfWeek, and therefore counts through the string to that point
+1 moves forward the position to the first (and next) character in the string
,3 reads 3 characters from and including that position then assigns it to ddd
ddd is then displayed (plus the rest) in MsgBox
Is that a pass (90% would be good)
[quote]On the subject of Date/Time formats…[/quote] Dave, I acknowledge this in the very first sentence in this post :).
I’ve tested Cho’s code by changing the region and language settings to the US, and even changed the start of week day. Cho’s code holds true.
d.AbbreviatedDate does not work the same, and is too dependent on the region/language settings.
.DayOfWeek, .Day, .Month, .Year is universal and will always work, unless of course another day is added to the working week - which maybe on the cards. if so, then Cho’s code would fail.
NthField? I admit I don’t know much with that. It may well work and I apologise for not testing it, others may wish to do so.
So, if there is a flaw in Cho’s code then I would like to know why/where it is.
My thanks and apologies to Cho