Data type mismatch in critera expression

Abdulkawi

Registered User.
Local time
Today, 06:03
Joined
Jul 30, 2010
Messages
13
Hi,

I'm getting the following error message "Data type mismatch in critera expression." when running a macro that opens a form and goes to the record clicked on and if "new" is clicked, then it goes to a new record.

Macro said:
Macro Name: frm_assets : txtOpen : OnClick : Embedded Macro

Condition: True

Action Name: OpenForm

Arguments:
frm_assetdetails, Form, , [Asset_No]=04444, , Dialog

Error Number: 2950

This only started happening when I changed "Asset_No" from being a 'Number' field to a 'Text' field as I needed to use 0's in front. When It is set as a 'Number' field, it works fine.

I have attatched a screenshot of the Macro to this thread.

How can I go around this? Tried a few things but I'm stuck.

Will appreciate all the help I can get.

Thanks!
 

Attachments

  • Untitled-2.jpg
    Untitled-2.jpg
    35.6 KB · Views: 390
Anything worth doing is worth doing in vba instead of Macro's

That being said, if you want/need the leading zero your field will (have to) be a string.

As such you need to put " around...
For number field:[Asset_No]=04444
Text field: [Asset_No]="04444"
Date field: [Asset_No]=#04444#
 
Anything worth doing is worth doing in vba instead of Macro's

That being said, if you want/need the leading zero your field will (have to) be a string.

As such you need to put " around...
For number field:[Asset_No]=04444
Text field: [Asset_No]="04444"
Date field: [Asset_No]=#04444#

Thanks for the fast reply! :D Although, which part of the macro would I need to change?

<--- Newbie :rolleyes:
 
Resolved. Thanks.

Doug Steele from UtterAccess said:
The OpenForm entrty needs to be

Code:
="[Asset_No=""" & Nz([Asset_No],0) & """",,Dialog
The SearchForRecord entry needs to be

Code:
,,First,="[Asset_No]=""" & [TempVars]![CurrentID] & """"
That's three double quotes in a row before, and four double quotes in a row after.
 

Users who are viewing this thread

Back
Top Bottom