Full Version: Docmd.openform No Results!
UtterAccess Forums > Microsoft® Access > Access Forms
SilverWorx
Hi Everyone,
I'm hoping that I can regain my sanity LOL
I have battled with syntax problems, expression problems and now my latest issue is that my docmd.openform is not returning any results when it should. I only have a dozen records for testing purposes and the filter should have produced at least one record.
I'm usually able to find an answer somewhere on the forum or the internet, however this has me stumped.
CODE
Private Sub cmdOpenForm_Click()
Dim strwhere As String
strwhere = "[auditor] = " & Me.Auditor & "And [audit complete]=" & Me.Audit_Complete
DoCmd.OpenForm "frmAgriStabilityAudits", , , strwhere, acNormal
End Sub

Does anyone have any suggestions?
Thank you <
Jeff B.
If this were mine, I'd go to the form itself, open it in design view, open the properties window, and hardcode in the filter criteria.
.. then close it and attempt to open it again.
When you say "no results", do you mean the form doesn't open? Or do you mean the form opens but displays nothing?
?Any chance the form is set to "Data Entry"? If so, it would open 'empty', since it would only be used to add new records, not look at the old ones.
SilverWorx
Hi Jeff,
Thank you ... thank you ... thank you!!!
My form was opening up, however it opened on a blank form and data entry was set to no.
Ooriginally started out trying to code in the filter criteria, however I was experiencing the same issues which is why I switched to the docmd option.
I did take your advice though and grabbed the where clause from the docmd ... got rid of the "me's" and plunked that into the filter criteria and what do ya know ... IT WORKED!! LOL
I've only been battling with this for 2 days LOL
Thanks again Jeff and for such a quick response <
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.