The Linux Page

Read/Write Cursor in MS-Access using VBA

When you want to modify a set of rows in a table but need to do some computation as you go, you probably want to use a cursor. That's my first idea. Whenever possible I do an UPDATE, but in one case that was just way too heavy (i.e. one SELECT plus one UPDATE per row!) Of course, in the end, the result is the same, but it is much less tedious to use a cursor.

How to use a cursor is very well explained in the documentation once you know the functions that you need to use to make it work. I only knew that the Recordset could be used that way.

QuickBooks and the address fields

When using the QODBC driver, it is possible to define all the Address fields. You have 5 x Addr, 5 x BlockAddr, City, Postal Code, Country, and Notes. This means quite many fields (15 to be precise.)

Trying to use the BlockAddr does not work.

The other fields work, but the result is that everything ends up in a blob of data. More or less, when you read it back, you'll have no clue what's what... That is one problem.

Now, the other problem is the following error:

Hiding columns in a Datasheet form

I have been looking for a way to hide some columns in a datasheet form.

The main reason to hide columns is to include data that you need whenever the user clicks somewhere, but that data is too technical to be shown. For instance, if you work with QODBC you have the ListID and TxnID to keep around but both look like GUID and thus are much better hidden from an every day user view.

The reason why I'm bringing this up is simple: whenever you have a field in a form that you want to hide, you click on it, go to the Format properties of that control and select Visible: No, I use that to ...

LEFT JOIN not supported

Often, when you use LEFT JOIN, you will have one table and one comparison.

Whenever you need more than one comparison, they must be put between parenthesis, otherwise you get that silly error saying: LEFT JOIN are not supported.

So you need to write something like this:

SELECT *

FROM table

LEFT JOIN other

ON (table.f1 = other.f1 AND table.f2 = other.f2)

WHERE table.f3 = 'something'

Multiple LEFT JOIN in your SQL order in MS-Access

As I was writing a report using VBA in MS-Access, I needed to get a name from a table. Yet, once in a while, that name does not exist in that table (for good reasons) and yet I'd like a more human name than the default number that you otherwise get... The result was a need for two LEFT JOIN in my SQL command.

  1. Using the result

I have three text boxes in my form:

(a) The one that the user sees with the valid result, it actually includes a simple VBA script:

=iif([text2]<>"",[text2],[text3])

(b) The one with the name when it exist

(c) The one with the ...

Automatic ComboBox in MS-Access

In MS-Access, you can select a special value for your combo boxes called:

"Find a record on my form based on the value I selected in my combo box"

In older versions of MS-Access, all you had to do is select the option and be done with it. However, the option would have no effect if the form was not properly assigned a source query.

In order to paliate to that problem, Microsoft decided to check the current form status and, if unlinked, hide the option altogether so you cannot make a mistake.

The problem is that for many people the train of thought was not automatically that way.

favicon

Have you seen animated icons in your tabs? This has been working for a while, with IE and FF and Co.

All you have to do is create an animated GIF file as your "favicon.ico", and it is better to name it .gif, by the way.

Because icons can now be pretty much any image format, not just .ico

And if you need some favicon for your site, check this one out: http://www.favicon.cc

Many of these are free!

PayPal secure website...

Today I connected on PayPal to check out a sale and got a message from my system saying that a certificate could not be verified because it had a PayPal URL but pointed to geo-trinity.com.

You can see the message below:

You have attempted to establish a connection with "ekkef42kcpmrf2r3.stats.paypal.com". However, the security certificate presented belongs to "*.geo-trinity.com". It is possible, though unlikely, that someone may be trying to intercept your communication with the web site.

If you suspect the certificate shown does not belong to ...

Tripwire and updates

Wired Train Station, Ready for Your Next Trip?

A week or so ago we updated our Ubuntu server to Intrepid and ran in a problem with tripwire that showed up like this:

tripwire -m u -r <report-file>
### Error: Keyfile Read/Write error.
### /etc/tripwire/site.key
### Exiting...

We tried to renew the key file with the following:

twadmin -m G -S /etc/tripwire/site.key

and it did not make any difference (other than the key file had a new date).

The permissions looked right too (root, u+rw only).

When trying to regenerate the .pol or .cfg we got the same error:

twadmin -m P -p /etc/tripwire/tw.pol ...

I put that radio button in the wrong Option Group, MS-Access

It happens all the time. You create two or three option groups and start adding radio buttons.

Then you write some VBA code attached to each button and/or their option group.

And at some point in the development you notice that one was put in the wrong option group.

Just deleting the option and creating a new one is not a good option because then you have to make totally sure you have the right setup and that can take some time to review.

Instead, you can move a radio button from one option group to another by following these steps: