Bug I can't fix (1 Viewer)

kirkm

Registered User.
Local time
Tomorrow, 09:00
Joined
Oct 30, 2008
Messages
1,257
Getting error 3464 "Data Mismatch in critical Expression"

Occurs on this line DoCmd.OpenForm "frmCDTracksFilter", acFormDS, "zqryCDFinder"
I can Open the Form by itself, but it contains the last instance of "zqryCDFinder", not the current one.
I can also open "zqryCDFinder" by itself; there's no errors and it has the correct data. It's the second time I've had this error, the first time I moved everything to another folder and it worked ok again. I was trying to isolate just the components being used to more easily see the problem. But it went away. Then as I entered more data and executed that line a few times the error returned.Have done "Compact & Repair" without any effect. Using Access 2007.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 17:00
Joined
Feb 19, 2002
Messages
43,257
What is zqryCDFinder? If you are trying to open a form using a filter or where clause, they need to be formatted correctly.

The syntax
DoCmd.OpenForm "frmCDTracksFilter", acFormDS, zqryCDFinder

might resolve the issue. This will allow the expression engine to evaluate zqryCDFinder.

However, given it's name, it sounds like it is actually a querydef and that can't be passed in this context. Only a filter or where clause

Somefieldname = "somevalue"
 

kirkm

Registered User.
Local time
Tomorrow, 09:00
Joined
Oct 30, 2008
Messages
1,257
Hello Pat,
This code has worked for 25 years! Until now... I can't see any reason for the error or what might be causing it. It's like something has become corrupted.

>The syntax
>DoCmd.OpenForm "frmCDTracksFilter", acFormDS, zqryCDFinder
>might resolve the issue. This will allow the expression engine to evaluate >zqryCDFinder.

Removing the quote from the query name? That gives 'Variable not defined'.

Are there any other checks I can do ? I've been trying to move all the affected bits into their own db, to see if the problem remains. But haven't succeeded yet.
 

kirkm

Registered User.
Local time
Tomorrow, 09:00
Joined
Oct 30, 2008
Messages
1,257
You asked What is zqryCDFinder? It's built on the fly and results in a querydef that should be properly constructed. When the error occurs, I can still run this query on its own.
 

kirkm

Registered User.
Local time
Tomorrow, 09:00
Joined
Oct 30, 2008
Messages
1,257
I think "frmCDTracksFilter" is corrupted. An older version exists and if I swap their names, the older version runs correctly.
However I don't know how to remove/replace the Form from a backup. Is that possible ?
 

Minty

AWF VIP
Local time
Today, 22:00
Joined
Jul 26, 2013
Messages
10,371
Take a backup. Of both the old version and the existing one.

Delete the existing corrupt form, then do a compact and repair on the database.
Re-open the database and then import the working form from the db copy you have made of the old working form.

Test, assuming it works then compact and repair again.

It may be worth importing all the objects into a fresh new database, as that removes any obscure debris from your existing database.
 

kirkm

Registered User.
Local time
Tomorrow, 09:00
Joined
Oct 30, 2008
Messages
1,257
Thanks very much Minty, that has fixed it superbly! :)

Cheers
 

Users who are viewing this thread

Top Bottom