April 2009 - Posts

Office 2007 SP2 is available for download

The 2007 Microsoft Office Suite Service Pack 2 (SP2) is available for download.   (Yeah, that title doesn't make a lot of sense but hey what do I know.)

Description of 2007 Microsoft Office Suite Service Pack 2 (SP2) and of Microsoft Office Language Pack 2007 SP2 has a few big areas of improvement when it comes to Access 2007.   You can download a detailed spreadsheet with all the fixes from the above page.

One interesting fix is "A user can only see the first 4,750 tables of an SQL database in the ODBC import dialog box. "  Yowzer.  

However the following I find particularly interesting: "Applying Microsoft Security Bulletin MS08-028 may cause a benign corruption error in multi-user databases."   What is a benign corruption issue?  That one puzzles me.

Posted by Tony | with no comments
Filed under: ,

The problems with currency fields

The Access help on currency fields states:

Use a Currency field to prevent rounding off during calculations. A Currency field is accurate to 15 digits to the left of the decimal point and 4 digits to the right. A Currency field occupies 8 bytes of disk space.

Excellent you figure.  Now if your code and queries are doing any multiplying or dividing you just have to remember to round to two decimal places.

And you're done.   Not so fast.  (Otherwise what's the point of this blog entry.)

Turns out the users can accidentally enter a tenth of a cent and/or a hundredth of a cent.  And you won't notice it unless the focus is on the field.   And you won't notice unless someone points out a weird rounding problem.

QueryRound3  QueryRound2

One of my clients MDBs had three of those fields.  Worse, one of them was on a parts price and thus would've continued to propagate for years.   Another client had the $0.001 on a rate table and it had been transferred to 500 of the 600K records on the table.

There is a KB article on this topic ACC2000: Round or Truncate Currency Values to the Intended Number of Decimals which shows how to put some simple code in the AfterUpdate event of a currency control.

To find those wonky data in the tables use the following query:

SELECT sriInvoiceAmount
FROM ServiceRecordInvoices
WHERE sriInvoiceAmount<>Round([sriInvoiceAmount],2);

or

QueryRound1

And you're done, right?   Wrong.

Dates

Dates can have a similar problem when the century portion is hidden by the default Windows date formatting.   You will find this when attempting to upsize the Access database to SQL Server as the SQL Server smalldatetime field has an epoch date of 1900-01-01.    In a table of several hundred thousand records we found 12 of these records where the value was before 1900.  The dates weren't actually used in any computations which is why no one had noticed them.

Internationalization

Whoops.  Most North American developers would think in terms of pennies so rounding to 2 decimal places is great.  But not so the folks in other countries.

So I created a constant on my hidden Global Options form and placed the value of 2 in it.  I referenced that form variable in all my code and queries so I'm set.   If I ever sell my software in another country I'm set to do some more investigating on the topic of how to fetch the currency decimal places from the users regional settings and go from there.

(Note that a potential problem could exist if the users had their systems formatted in different currencies or different decimal places.  Which is why I'm ignoring this end of the topic for now.)

Currency formatting display.

Finally when I did some searching on this topic I came across several pages on a related topic again of interest to folks whose applications need to support multiple currencies. 

Using the Currency field data type - without the hassle
Currency format
Microsoft Access and the Ten-Year-Old Currency Bug

Posted by Tony | with no comments
Filed under:

I sure hope there is a final exam on this course

Project title:  Need 15 Queries in Access 

"I need someone who can make 15 queries in Access 2007 and have to be done in sql view (this is a must). I want this for school home work and need them fast, as soon as possible. I will provide you with the tables and the queries I need, they are attached so you can tell me if you can do it or not. Payment will be made in full after project is completed. I will not consider anyone without any reviews. Bid only if you can do this project, I need it fast so don't make me waste my time. I wil... "

And if you click through the link Place my bid for this project! you will see the replies.  Wow.

Posted by Tony | with no comments
Filed under: , ,

Twitter and Swine Flu

Swine Flu 

I don't get Twitter.  There is so much crap on there I just don't care about.  And my life is far too boring to post any such minutiae.   So I laughed quite hard when I saw the XKCD cartoon.

Ok, so it is interesting reading about my sisters life over in Sri Lanka because it is so different than here.    The lizard in the back yard was just cool. 

Posted by Tony | with no comments
Filed under: , ,

Access Demos, tutorials and basics

Thanks to a posting by Bill Mosca Access (2007) Demo Videos can be found at Access Demos

Also see Access Basics by Crystal fellow Access MVP.   She also has some Video Tutorials

Posted by Tony | with no comments
Filed under: , ,

Some code to tame the Office Ribbon for Access (2007)

Albert Kallal, fellow Access MVP just announced the following:

"The office ribbon is an amazing new interface.

The problem with the ribbon is that takes a lot of code to change the ribbon at runtime.

Solution: With my ribbon class you can enable, hide, change label text, or pictures of a button with great ease and very little code.

This ribbon class allows you to use the simple "old style" syntax to enable, hide, or change the text of a button.  eg:

meRib("Button1").enabled = true
meRib("Button1").label = "this is the new text for button1 on the ribbon"
meRib("Button1").picture = "HappyFace.png"

Some code to tame the Office Ribbon for Access (2007)

There may be some updates suggested by fellow MVPs so check back to that page on a regular basis.

Posted by Tony | with no comments
Filed under: ,

Overflow error 6

A newsgroup poster had the following very standard lines of code

strSQL = "SELECT Mytable.Field1, Mytable.Field2, Mytable.Field3 FROM Mytable"
SET rs = Currentdb.OpenRecordset(strSQL,dbOpenDynaset)

The error was Overflow error 6.

He then replied a day  later indicating that one of the variables in his code had been defined as an integer when it should've been a long.   Now this is rather obscure although, once you think about it, quite understandable.

As a matter of course I always use Long fields for integers even if there will only ever be a few hundred records in the table.   So I would like to think I would never have seen this message.  But you never know. 

Posted by Tony | 2 comment(s)
Filed under: , ,

Did you know you can right click on a scroll bar?

And you get some interesting options.

I never knew that.   Some kind of blind spot is all I can think of.

Posted by Tony | 3 comment(s)
Filed under:

A bizarre report problem

So Jim phones me with a very strange report problem as per the below portion of the report.  It's impossible to have the PM010-03B as a duplicate as that is a no duplicates allowed index in the table.   Besides where is the data in the field to the left and the 0.0% amount on the right hand side which is represented by the circles?

CtrlEnterProblem

The query on which the report is based doesn't show that duplicate value.

CtrlEnterProblem3

Note that the X in 03AX in the first column and the XXXX as well as PM010-03A being twice was part of Jim's testing trying to figure out the problem.

Here is the report in design view.   Simple, right?

CtrlEnterProblem2

While there is some code behind the form it had nothing to do with these fields.  Commenting out the code made no difference.

The fields did not have the Hide Duplicates property set to Yes.

So we added some labels to various sections on the report.  Only one record and one set of labels were printing and yet we had the duplicate line.  Stranger and stranger.

Now we added a constant to the actActivityDescription control so it looked like "=[actActivityDescription]&"   testing".  Still only printed one line but this time the "testing" was only on the second line.   Getting even weirder.

Suddenly the light bulb went on.

Somehow the user entered the PM010-03B MOD in the activity description on the form, hit Ctrl+Enter and then re-entered PM010-03B MOD on the second line.   But all the user could see was one line so you can't blame them.

CtrlEnterProblem4

Truly bizarre.   I doubt I'll ever see this one again.

Posted by Tony | 2 comment(s)
Filed under: ,

Access Performance FAQ - local default printer instead of network

If your system is painfully slow when updating forms or reports in design view try creating a local printer and setting that as the default printer.   This could be a PDF printer such as the open source PDFCreator or free CutePDF Writer.  This may be more applicable to Access 2007 than previous versions.  Alternatively just create a generic printer.

The above was just added the to Microsoft Access Performance FAQ page.

Posted by Tony | with no comments
Filed under: ,

Waking up Canadian

Waking up Canadian is a very cool and amusing video. I'm told this has gone low key viral.   Thanks to Sasha the excellent Canadian Microsoft MVP lead for passing this one on.

1) I'm sure though that many Canadian bureaucrats had to go outsize their comfort zone to approve this on.

2) There was quite a lengthy and acrimonious discussion before the current Maple Leaf flag was finally chosen.  The Wiki article doesn't do the fighting justice.  Or so I'm told.  I was too young then to notice.

Posted by Tony | with no comments
Filed under:

Can't sleep

Can't sleep

I got a giggle out of that one.   If you don't get it you're not a programmer/developer.

Posted by Tony | with no comments

Access 2007 SP2

Interesting updates (among others) in Service Pack 2 for the 2007 Microsoft Office System due to ship April 28th:

- The Microsoft Save As PDF or XPS add-in has been built into Office applications in SP2. Users no longer have to download and install the add-in separately.

Hmm, so the Microsoft lawyers changed their minds on Adobe's PDF patent claims or something like that?   Nah, don't get me started on the ridiculous state of software patents in the USA.

Note: I'm not picking on Microsoft or Adobe here.  I think most, or 99%, of software patents are useless and despicable.   Only the frigging lawyers win.   Copyright is fine though.

Posted by Tony | with no comments
Filed under: ,

Added to the Auto FE Updater FAQ

Q:  I'm moving the files from one server to another server.  How do I easily use the Auto FE Updater to get the users to use the FE from a folder on the new server? 
Q: I want to move the BE MDB to a different folder on the same server.

There are two parts to this. One is to replace the FE MDE so it's linked to the new server path and folder structure and the other to change the target of the shortcut to use the new Auto FE Updater INI file.

On the day of the switchover delete/rename the BE MDB file from the old server so just in case something gets missed they can't work with the old MDB file.  You're moving it to a new server anyhow so don't leave it easily available on the old server.

Copy the new FE MDE which is linked to the new BE server and folder to the FE path on the old server. This way when the users run the old shortcut for the first time they will get switched over to the new FE MDE.

Update the AutoFEUpdater INI file on the old server to be the same as the INI file on the new server. When the users run the new INI for the first time they will get a warning message saying the shortcut on their system is different. Use the ShortcutErrorMessageHandling=2 option on the INI file on the old server to ignore that message so the shortcut gets updated transparently.

This can all be tested ahead of time.

http://www.granite.ab.ca/access/autofe/faq.htm

Posted by Tony | with no comments
Filed under:

I've always been skeptical about Cloud computing ...

I've never quite understood the allure of cloud computing for individuals or businesses.  Although I backup my files, including emails, every few days.  Most consumers don't do that.  I can understand why folks would want to use Hotmail, Gmail, Yahoo, etc.

Oh have I mentioned my mechanic friend who may have lost three years worth of emails and other files in his Hotmail account.  It would appear that a malicious ex girl friend sent a bunch of ugly porn spam from his account and Hotmail shut his account down for TOS violations.    Things are still pending on that one last I heard.

But cloud computing for businesses?   If you're big enough to need a SQL Server then what's the problem with having your own semi-competent IT staff which run it?   If there's a problem the CEO can look the IT person in the eye and ask what is going on.

Turns out McKinsey & Co, who are some kind of consulting outfit that are supposedly trusted by CEO types, agrees with me.   McKinsey: adopt the cloud, lose money - Virtualize your datacenter instead.   The summary done by the Reg of the Mkinsey report sounds about right to me.

My friend Jim, who run the IT department at his employer, loves the whole concept of Virtualization and such.  As far as I know he is running all his servers as virtual systems under a high powered server against a SAN (or some such) with raided, hot swappable hard drives and daily tape backups.   And if he likes them then that's good enough for me.

Posted by Tony | with no comments
Filed under: ,

New version of the Granite Fleet Manager - V1.63

A new version of the Granite Fleet Manager is available for download.  Nothing major.  Mostly a lot of updates in the temporary locations forms to make it easier to move equipment from job site to job site or back and forth to your main yard.

Posted by Tony | 1 comment(s)

Test your VBA coding skills and win!

MSDN® is sponsoring a coding contest for Office 2007, named OfficePalooza! This sweepstakes will run two weeks beginning April 20, 2009, and features ten fun Visual Basic of Applications™ (VBA) coding challenges in the form of puzzles and games. Each entrant will earn a chance to win one of hundreds of available prizes, determined by a random drawing at the end of the contest.

In conjunction with this contest, an Advanced Business User theme will run on Microsoft Office Online from mid-April to mid-May, and will showcase the automation and extensibility aspects of Office 2007 through macros, custom VBA coding, the Fluent UI, and Office Open XML.  This collaborative effort will also highlight existing and newly-created content on the MSDN Microsoft Office Developer Center.

There are a few Access challenges which could be interesting.

Posted by Tony | 2 comment(s)
Filed under: ,

How the Air Force deals with blogs - relevant to newsgroups and forums

I read with great interest the blog entry How the Air Force deals with blogs as well as the referenced Bureaucracies and New Media: How the Airforce deals with blogs.  I totally agree with the sentence "At the same time what strikes me is this handy little chart is codified good judgment.".   The diagram done up by the Air Force is what goes through my mind every time I read a newsgroup or forum or blog posting in a flash of a second.   Especially when dealing with trolls.

Posted by Tony | with no comments
Filed under:

Updating backend MDB tables, fields, relationships and indexes

Short posting

I like using the Compare'Em utility which creates the necessary VBA code to create/update tables, fields, relationships and indexes.  It works by comparing your last version of the BE MDB with the latest development version of the BE MDB.    While I don't need the Pro version nevertheless I paid the $10 for it.   It does have it's quirks about which I've emailed the author.

Long posting

I have a one record table in the front end and back end MDB with the FE and BE version number.   Whenever I open the FE MDB I run code which compares the version numbers in the current FE MDB and BE MDB.  If different the code then executes subroutines based on the version on the BE.  As each version of the is updated I update the version field to the successfully updated version.  I also run the code if the user switches from one BE MDB to another.

I also execute queries in the midst of the above created VBA code to clean up data as required.  For example I recently created a service techs table in the Granite Fleet Manager.  In the past the service techs fields was just a string field on the service order table.

' Append records to ServiceRecords table
strSQL = "INSERT INTO ServiceTech ( stServiceTech ) " & _
    " IN '" & strDatabasePathandName & "' " & _
    "SELECT srServicePerson FROM ServiceRecords " & _
    " IN '" & strDatabasePathandName & "' " & _
    "GROUP BY srServicePerson " & _
    "HAVING (srServicePerson Is Not Null);"
CurrentDb.Execute strSQL, dbFailOnError

Note the IN statement which allows you to update tables in MDBs which aren't linked.   Of course I had to then update the service order with the autonumber ID in the above just created service techs table and then delete the field from the service order table.

As you well imagine there are many variations of John Smith in the various service orders.   John, John S, John S., and so forth.  So I gave the users a form to clean up the data.   (The High Rate record was for testing a high rate of pay and invoicing to ensure there was lots of room on various forms and reports.)

ServiceTechsToMerge

Mechanics aren't paid for their typing or spelling.  <smile>

Posted by Tony | with no comments

Which control has the focus?

Sometimes when you're tabbing around a form the focus disappears.  Dirk Goldgar, fellow Access MVP, has a very useful and simple solution to determining which control has the focus in a newsgroup posting.  

"If you want to know where the focus is at some point when it seems to have
disappeared, press Ctrl+G to bring up the Immediate Window, and enter the
statement

    ?Screen.ActiveControl.Name

After you press enter, the name of the active control should be displayed on
the next line. "

Posted by Tony | with no comments
Filed under: ,
More Posts Next page »