Filter Menu blakc issue (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 03:50
Joined
Dec 1, 2014
Messages
401
Hi. I have now got my accmdfiltermenu command working on my continuous form but have encountered a problem with my code:

Code:
DoCmd.GoToControl "Txt_Column1"
DoCmd.GoToRecord , "", acFirst
DoCmd.RunCommand acCmdFilterMenu

Works great. The line to go to first record is so the filter menu always appears at top of screen near the label title as opposed to whatever record i am on in the form (which has been made to look like datasheet).

Issue is if i choose a blank from the filter options it returns no records as i would expect. But then when i double click the label again to reenter the filtermenu it errors out on

Code:
DoCmd.GoToControl "Txt_Column1"

Assume this is because there is no records visible so cant go to the record as instructed.

What is the fix for this. Could i do a dcount of current records and say if greather than zero run normal code but if 0 just do the filter? Is that the best approach?
 

Ranman256

Well-known member
Local time
Yesterday, 22:50
Joined
Apr 9, 2015
Messages
4,339
don't GOTO 1 at a time, just filter all records.

Code:
me.filter = "[field]='" & txtBox & "'"
me.filterOn = true
 

Users who are viewing this thread

Top Bottom