Open Forum Multiple Criteria

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!
 
S

Stuart McCall

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] & "'"
 
J

John W. Vinson

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]
 
T

TechTutors

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top