Access – Bug – ldb/laccdb not going away

Software Bug

There’s yet another bug, dating back to at least February 13th by the looks of things, causing headaches to a select group of Access user and the symptom is that the lock file (ldb/laccdb) does not go away after the database or connection to the database is closed.

All I can say is that the Access Dev Team were made aware of the issue and we are told that a fix should be coming soon. Fingers crossed.

2020-03-03 – Official Workaround

Continue reading

Access – Auto-Closing Forms

In a forum, the question was

Is there a way to automatically close a form once the cursor was moved off of it.

I don’t know why, but this was one of those forum questions that truly got me curious and so I needed to find a way to do this for my own personal knowledge.

I came up with an initial solution, but it wasn’t foolproof and wouldn’t necessarily work for all setups and so I slept on it and woke up with a fundamentally simple solution. I have to admit, the solution only came to me because of some recent work I had to do for a client which required me to override the system cursor (in an Outlook project) and so I had become aware of certain available cursor APIs. Armed with this basic knowledge, I figure there had to be a way to compare the cursor’s position against the form’s boundaries and so the solution was born! With 2 simple APIs and the form’s timer event, it became pretty straightforward to accomplish and can be ported to pretty much any setup.

The following demo has everything you need (both 32 and 64-bit API declarations) with a working example so you can dissect the concept to be in a position to integrate it into your own project.

Continue reading

LoadCursor Not Working in 64-bit – Win32API_PtrSafe is Wrong

I’ll Keep this post short and sweet.

I’ve been working with the LoadCursor API:

Private Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long

for a while in 32-bit. Recently, I needed to convert it for use in 64-bit version of Office and turned to Microsoft’s Win32API_PtrSafe.txt (which is the Bible for API declarations if you weren’t already aware) and quickly got the code:

Public Declare PtrSafe Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As LongPtr, ByVal lpCursorName As String) As LongPtr

, but it wouldn’t work?

Continue reading

VBA – Replace String Between Delimiters

Here’s another question from an UtterAccess that I helped with, further perfected and thought might serve others.

How can you replace all the occurrences of a string within another string?

Now there are various approaches that can work, but I knew the most straightforward solution would be to employ the power of Regular Expressions again.

Continue reading

Access – The Specified Field … Could Refer To More Than One Table …

Today’s nugget of knowledge is brought to you by “me banging my head against my computer”!

The Issue

Once again, working on a client’s database, I was faced with an error that made no sense.

The specified field ‘[TableName].[FieldName]’ could refer to more than one table listed in the FROM clause of your SQL statement.

Now, by the nature of the error message, providing a distinct fully qualified table name and field name, made absolutely no sense whatsoever.

Continue reading

VBA – Is AlphaNumeric

One last post regarding validating inputs using Regular Expressions, specifically ensuring a string is alphanumeric.

Like all the previous posts, it is merely a question of using the appropriate Pattern as shown below!
Continue reading

VBA – Is Numeric

Another posts about the power of using Regular Expressions, and thought provide a simple function to validate if an entry is entirely numeric (no alphabetic or special characters), just 0 through 9.

Like for alphabetical validation, typically you’ll see code that will loop through a string character by character and validate the value against the ascii value, but with RegEx, it can be done with a simple pattern as shown below.
Continue reading

VBA – Is Alpha

Continuing on my recent posts regarding using Regular Expressions, I thought I should provide a simple function to validate if an entry is entirely alpha (no numbers or special characters), just a to z.

Typically you’ll see code that will loop through a string character by character and validate the value against the ascii value, but with RegEx, it can be done with a simple pattern as shown below.
Continue reading

VBA – Is Uppercase?

Once again, helping in a forum, a user needed a way to determine if the entry was entirely in Uppercase or not. In this particular case, the user absolutely wanted to use a Regular Expression for the validation. So I thought I’d share how it can be done in the hopes it may help others with a similar need.

Continue reading