Access DoCmd.OpenForm Not Working

Posted by user961743 on Stack Overflow See other posts from Stack Overflow or by user961743
Published on 2012-04-15T23:23:30Z Indexed on 2012/04/15 23:29 UTC
Read the original article Hit count: 250

Filed under:
|

Looking for a second set of eyes to figure out my problem with an Access form filter. I created a search form, when filled in, appends search criteria to a string variable (strQuery) that is put in place to the [WhereCondition] for opening a form. However, when the script is ran, nothing comes up except for a filtered form with no records.

Here is the line that opens the form:

DoCmd.OpenForm "ADD_NEW_NCMR", , , strQuery

Before the line is ran, strQuery equals:

1=1 AND [NCMR].[NCMR_NUM] = '12-129'

The form name, and table.column combination are all correct. In fact, using the DCount function returns the result of 1, which is correct for this query, and returns the correct number for other queries as well. This makes me think that there is nothing wrong with the where condition.

DCount("[NCMR_NUM]", "NCMR", strQuery)

© Stack Overflow or respective owner

Related posts about sql

Related posts about access