Question Equals function problem in linked table

coder

New member
Local time
Today, 04:25
Joined
Mar 12, 2012
Messages
1
This is to become my first post, so I would like to say hello to everyone reading this forum.

I have encountered a strange problem using MS Access and I am not sure how to categorize it so I am posting here-

I am using MS Access 2010. I have two mdb files. First one was created with MS Access 2000 or lower (probably 97). The second one was created with MS Access 2000. Lets call there databases B and A respectively.
Database A also contains a form which is used for manipulating data.

Database A has many tables and all tables are linked from database B.

The problem arises, when the user tries to process some information on the form (database A). Access yields a run-time 94 error. When I debug, I seem to get stuck at these two lines of code:

OLD_LEN = DLookup("[col1]", "tableX", "[col2] = '123456'")
NEW_LEN = Replace(some_value / OLD_LEN, ",", ".") <--- this row throws an exception

OLD_LEN's value is NULL/Nothing.
First I thought, OK, string parameters in the first line are wrong. So I check, double check and recheck. No error was made.

Then I "forget" the VBA coding and go straight to the tableX (that is: i double click the table and get containing records). As I am using MS Access 2010, I try to filter out col2 with right click and "equals to". To my surprise, I get zero records. If I use "contains" everything works fine.
To my even bigger surprise, ALL other columns don't exhibit this behaviour.
I looked at the column properties but I cannot see anything unordinary.

And .... and this is the real cherry on top ... when I IMPORT table rather than LINK, everything works fine.

I would greatly appreciate any comment or help on this matter. I am working on a project with a very short deadline and I seem to be stuck without a way out.

Best regards
 
OLD_LEN = DLookup("[col1]", "tableX", "[col2] = '123456'")
NEW_LEN = Replace(some_value / OLD_LEN, ",", ".") <--- this row throws an exception

OLD_LEN's value is NULL/Nothing.

Maybe Access is interpreting this as dividing-by-zero ?
try writing it like;

If Not IsNull(OLD_LEN) Then
NEW_LEN = Replace(some_value / OLD_LEN, ",", ".")
End If
 
If you have a leading space in your text field you'll get the effect you describe
 

Users who are viewing this thread

Back
Top Bottom