简体   繁体   中英

MS Access Adding a Filtering ToolBar to Form

I have Microsoft Access Form where I have table of data I want to be able to add a filtering toolbar to the form in MBE mode. Note MBE not in the designer mode of MDB. Ie I want a filter on the distributed MBE file.

In Form.Open event I added:

Private Sub Form_Open(Cancel As Integer)
  DoCmd.ShowToolbar "Ribbon", acToolbarYes
  DoCmd.ShowToolbar "ribbonMain", acToolbarYes
  DoCmd.ShowToolbar "Menu Bar", acToolbarYes

End Sub

I also tried

Private Sub Ctl__Click()
  Dim db As DAO.Database
  Dim prop As DAO.Property
  Set db = CurrentDb()
  DoCmd.ShowToolbar "Ribbon", acToolbarYes
End Sub

Also, Access Button - > Access Opiton ->Current Database Under the Ribbon and Toolbar Options: Checked Allowed Built-in Toolbars. Also, Ribbon Name is "ribbonMain".

I still cannot see the Toolbar in the top of Form. What am I missing in the code or access page set up. I am running on MS Access 2003. I would really like to have same filtering you see in design mode of a table in an deployed MBE file.

I would suggest putting the code in the On load even instead also DoCmd.ShowToolbar "Ribbon", acToolbarYes may cause error in access 2003. When i was building my database i found this post helpful. http://www.access-programmers.co.uk/forums/showthread.php?t=97578

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM