Open Forum Multiple Criteria

  • Thread starter Thread starter TechTutors
  • Start date Start date
T

TechTutors

Hello,

First off, I'd like to thank you all for assisting me in this matter.

I'm atrying ot open a forum from another form with multiple matching criteria.

Here is the code I have thus far...

stLinkCriteria = "[WO_ID]=" & "'" & Me![ID] & "' And [WO_CorpID]=" & "'"
& Me![CORP_ID] & "' And [WO_ImportAcct]=" & "'" & Me![ACCT] & """"

When I click Open form, it says Microsoft Office Access can't find the field
'ACCT' referred to in your expression.

WO_ID and ID are text fields
WO_CorpID and CORP_ID are Number fields
WO_ImportAcct and ACCT are text fields

All the help you could provide would be fantastic! Thanks!
 
TechTutors said:
Hello,

First off, I'd like to thank you all for assisting me in this matter.

I'm atrying ot open a forum from another form with multiple matching
criteria.

Here is the code I have thus far...

stLinkCriteria = "[WO_ID]=" & "'" & Me![ID] & "' And [WO_CorpID]=" &
"'"
& Me![CORP_ID] & "' And [WO_ImportAcct]=" & "'" & Me![ACCT] & """"

When I click Open form, it says Microsoft Office Access can't find the
field
'ACCT' referred to in your expression.

WO_ID and ID are text fields
WO_CorpID and CORP_ID are Number fields
WO_ImportAcct and ACCT are text fields

All the help you could provide would be fantastic! Thanks!

You missed an apostrophe at the end of the line. The line should read:

stLinkCriteria = "[WO_ID]='" & Me![id] & "' And [WO_CorpID]='" & _
Me![CORP_ID] & "' And [WO_ImportAcct]='" & Me![ACCT] & "'"
 
When I click Open form, it says Microsoft Office Access can't find the field
'ACCT' referred to in your expression.

Where is this code being executed from? If it's a Form, is there a control
named ACCT on this form? Is there a field named WO_ImportAcct in the
Recordsource of the form you're opening?

You can simplify some of the quotes by including the ' delimiters within the
unvarying "boilerplate" quoted strings:

stLinkCriteria = "[WO_ID]='" & Me![ID] & "' And [WO_CorpID]='"
& Me![CORP_ID] & "' And [WO_ImportAcct]='" & Me![ACCT] & "'"


John W. Vinson [MVP]
 
Thank you both very much!

My problem is now solved!

John W. Vinson said:
When I click Open form, it says Microsoft Office Access can't find the field
'ACCT' referred to in your expression.

Where is this code being executed from? If it's a Form, is there a control
named ACCT on this form? Is there a field named WO_ImportAcct in the
Recordsource of the form you're opening?

You can simplify some of the quotes by including the ' delimiters within the
unvarying "boilerplate" quoted strings:

stLinkCriteria = "[WO_ID]='" & Me![ID] & "' And [WO_CorpID]='"
& Me![CORP_ID] & "' And [WO_ImportAcct]='" & Me![ACCT] & "'"


John W. Vinson [MVP]
 
Back
Top