SteveL13
asked on
Open form either with table as record source or as query as record source
I have a form with two command buttons. One of them is set to open a form via: (opens the form for a new record)
DoCmd.OpenForm "frmContacts", acNormal, , , acFormAdd, acWindowNormal
But I also want to be able to open the same form with a query as it's record source. When the form opens it will display all of the records that meet the query criteria.
How can I do the 2nd option?
DoCmd.OpenForm "frmContacts", acNormal, , , acFormAdd, acWindowNormal
But I also want to be able to open the same form with a query as it's record source. When the form opens it will display all of the records that meet the query criteria.
How can I do the 2nd option?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am sure Kelvin can assist
ASKER
I got it by accident.
Forms!frmContacts.Form.All owAddition s = False
Thank you to both of you. Kelvin for the solution that worked because the query was already written. Jeffrey for you excellent insight as to how I should do it in the future.
Forms!frmContacts.Form.All
Thank you to both of you. Kelvin for the solution that worked because the query was already written. Jeffrey for you excellent insight as to how I should do it in the future.
That's what EE is about. Lots of ideas and different ways to achieve things. No real right or wrong answer, but mostly solutions you can choose from.
Kelvin
Kelvin
SteveL13,
As you know...
There are always alternate methods...
What's funny here is that, as I was re-reading your question, I realized how much trouble a "complex" query would be to recreate as a Where criteria.
Believe me, ...sometimes it is a lot simpler to just make a query than it is to screw around with all the crazy single and double quotes, and the SQL syntax.
;-)
You could have just selected Kelvins post, as he answered you post directly.
Jeff
As you know...
There are always alternate methods...
What's funny here is that, as I was re-reading your question, I realized how much trouble a "complex" query would be to recreate as a Where criteria.
Believe me, ...sometimes it is a lot simpler to just make a query than it is to screw around with all the crazy single and double quotes, and the SQL syntax.
;-)
You could have just selected Kelvins post, as he answered you post directly.
Jeff
No worries Jeff, we all added to his knowledge.
Happy to share the points, I'm not part of any "points race".
Happy to share the points, I'm not part of any "points race".
ASKER