DoCmd.OpenForm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to open a form that filters on several criteria

here are the two conditions:
[gain] >2 and [type] = "special pass"
[gain] >2 and [type] = "pass"

gain is a number field, type is a text field

Here is what I tried:

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND [type] = 'special pass'" Or
"[gain] > 2 AND [type] = 'pass'"
 
try the following, as

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND ([type] = 'special pass' Or
[type] = 'pass')"

the above goes on one line, of course, regardless of line wrap in this post.

hth
 
What happens when you try that?

Have you used Access HELP to make sure your syntax is correct?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I am setting the values. They won't change

Falty said:
where abouts are the values coming from
--
Let me know if I have helped by replying or clicking question answered

Falty


Fipp said:
I am trying to open a form that filters on several criteria

here are the two conditions:
[gain] >2 and [type] = "special pass"
[gain] >2 and [type] = "pass"

gain is a number field, type is a text field

Here is what I tried:

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND [type] = 'special pass'" Or
"[gain] > 2 AND [type] = 'pass'"
 
the values are in the form being opened in the [gain] field and the [type]
field.

Falty said:
where abouts are the values coming from
--
Let me know if I have helped by replying or clicking question answered

Falty


Fipp said:
I am trying to open a form that filters on several criteria

here are the two conditions:
[gain] >2 and [type] = "special pass"
[gain] >2 and [type] = "pass"

gain is a number field, type is a text field

Here is what I tried:

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND [type] = 'special pass'" Or
"[gain] > 2 AND [type] = 'pass'"
 
Forgive me if i am being stupid, but if you are always filtering by those
criteria could you not add them to a query an set that query as the reord
source
--
Let me know if I have helped by replying or clicking question answered

Falty


Jeff Boyce said:
What happens when you try that?

Have you used Access HELP to make sure your syntax is correct?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Fipp said:
I am trying to open a form that filters on several criteria

here are the two conditions:
[gain] >2 and [type] = "special pass"
[gain] >2 and [type] = "pass"

gain is a number field, type is a text field

Here is what I tried:

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND [type] = 'special pass'" Or
"[gain] > 2 AND [type] = 'pass'"
 
Same thing as I was thinking


Falty said:
Forgive me if i am being stupid, but if you are always filtering by those
criteria could you not add them to a query an set that query as the reord
source
--
Let me know if I have helped by replying or clicking question answered

Falty


Jeff Boyce said:
What happens when you try that?

Have you used Access HELP to make sure your syntax is correct?

Regards

Jeff Boyce
Microsoft Office/Access MVP

Fipp said:
I am trying to open a form that filters on several criteria

here are the two conditions:
[gain] >2 and [type] = "special pass"
[gain] >2 and [type] = "pass"

gain is a number field, type is a text field

Here is what I tried:

DoCmd.OpenForm "logfrm", , , "[gain] > 2 AND [type] = 'special pass'"
Or
"[gain] > 2 AND [type] = 'pass'"
 

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

Back
Top