Tuesday, October 26, 2010 10:40 AM
I have an application that was written in Access 2007 and almost exclusively in VBA. There are 4 main forms 1. Matters 2. Case Details 3. Document Assembly 4 Time and Billing. I used a 2007 form template with the bar running through the form header and used that as a navigation bar with the names of the forms as command buttons.
I created a Navigation Module for each of the four forms so that anytime the command button is pressed on any of the forms it calls the public sub for that form and navigates to the form and that form is filtered on the current record of the previous form.
I give an exam0ple below so if the user is currently in the Matters form and clicks the cmdCaseDetails button it would call the NavCaseDetails public sub and stay filtered on whatever record the user was on.
Public Sub NavCaseDetails()
Dim strCriteria As String
Dim ID As Long
Dim strFormName As String
On Error GoTo HandleError
strFormName = "frmCaseDetails"
strCriteria = "[ID] = " & Screen.ActiveForm.ID
DoCmd.OpenForm strFormName, , , strCriteria
MsgBox Err.Description & vbCrLf & Err.Number, , "Juris Documents..."
This works perfectly and I like the UI I created in Access 2007 and BTW loved the features of Access 2007 to re-use forms as templates etc. great for programming and I really liked the flexibility in the UI really outstanding. Okay enough praise for Access 2007.
Heres the rub I like the Navigation Forms in 2010 even better! My problem is that I don't like macros. All right its not that I don't like them its just that like everyone else that wrtis an applicaiton in access I used VBA because of the flexibilty. I can find no good source to figure out how to simply program the navigation form tab to open the target, which in Access 2010 Navigation form would now be subform frmCaseDetails and keep the filtered record the user was last working on in whatever form he was in.
I prefer VBA as a solution because as with the above example I created a module and wrote one code for each form then all I had to do was simply call the public sub for that form on a command button in a form. I have tried to write a macro with a TempVar but I would have to rewrite it for each button on the various forms.
So how can I migrate my heretofor awesome UI in Access 2007 to the 2010 navigation form and accomplich the same thing.
any help would be greatly appreciated.
Thursday, October 28, 2010 11:34 AMModerator
Hello Timothy ,
Thank you for posting! I have read your post, but I couldn’t figure out what problem you’re going to settle. So, in order to analyze your problem better, could you clarify some points?
1． I can find no good source to figure out how to simply program the navigation form tab to open the target, which in Access 2010 Navigation form would now be subform frmCaseDetails and keep the filtered record the user was last working on in whatever form he was in.
Do you mean how to open target Form programmatically? If yes, you can add bind On Click event with a function on Navigation Button properties, such as =NavCaseDetails()
2. So how can I migrate my heretofor awesome UI in Access 2007 to the 2010 navigation form and accomplich the same thing
Could you tell me the details of what the same thing you want in Access2010?
Hopefully, it can do some help to you, feel free to follow up! And I will be happy to be of assistant. Wish a nice day!
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Wednesday, November 03, 2010 4:19 PM
Thanks for the reply.
The app has 4 main forms
frmMatter, frmCaseDetails, frmMailMerge, frmTimeBilling
The header in the forms are all identical templates (application parts). I used the template that has a header with a shaded bar running through it. That shaded bar serves as a navigation bar for the 4 forms. Each form has a button (actually transparent buttons with text and an embeded picture similar to the new 2010 UI for Office 2010)
I any event for a couple of reasons and as you can see from the code I only want one form open at a time and I want the form locked on the record the user was on when he switches forms. I.e. if the user is on the Jones record in frmMatter and clicks the frmCaseDetails button, as you can see from the code.
frmMatter passes the record criteria to frmCaseDetails
frmMatter then closes and
FrmCaseDetails opens and is filtered on the Jones record.
I want to do the exact same thing with the navigation tabs and navigation forms
In other words the tabs on the navigation forms would open
frmMatter, frmCaseDetails, frmMailMerge, frmTimeBilling
As the target/sub form for that tab and the last record would be filtered on the record the person was last using on the previous form.
I hope that makes sense
Thursday, November 04, 2010 3:26 AMYes, you can use the browse command.eg:DoCmd.BrowseTo acBrowseToForm, _"Form3", _"Navigation Form.NavigationSubForm", _"where condition"Note that if in say a choice of 5 nav buttons, you do NOT have form3 (as in the above example) then the current existing sub form will be replaced. However, if the 4th button is set to form3, then the above would display form 3, and the 4th button would highlight.And, as the above shows, you can add in a where clause.The above browse to command of course is available in both VBA, and macro.--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Friday, December 17, 2010 2:06 AMDid you ever get this to work? I want to use the Navigation Form in a similar fasion. Bob
Thursday, September 01, 2011 1:14 PM
I found this thread while searching for help on this problem, and I have seen similar posts by Albert. I tried this command, but keep getting an error message.
I have a navigation form called "Main" and a form called "frmGuestInfo" as one of Main's subforms. I have a line of code called from another form (a pop up search form) that says:
DoCmd.BrowseTo acBrowseToForm, "frmGuestInfo", "Main.NavigationSubform"
Access complains that BrowseTo requires a valid Path argument.
Any idea about what I am doing wrong? It has been a long time since I used Access (early in my IT career), but this doesn't seem too complicated & therefor all the more frustrating that I am probably missing something basic.
Friday, September 02, 2011 11:44 AM
OK, I found the answer to my problem here http://blogs.office.com/b/microsoft-access/archive/2010/02/24/access-2010-browseto-docmd-and-macro-action.aspx. "The first form in the path must be the form that is currently loaded directly in the Access window (or browser window if the application is running on the web.) This means that the Path parameter only allows you to change the contents of a currently-visible subform control."
Since I was using a search form called from the navigation form, all I had to do was close the search form before using the BrowseTo command. Now it works fine.
P.S. Cannot get the where part to work, but I'm sure I'll be able to figure that out.
P.P.S. Maybe not so sure - here is a post about my failure to get the where condition to work: http://social.msdn.microsoft.com/Forums/en-US/accessdev/thread/8ddee4ea-32a9-4c14-9f34-bcb3859b9f19
- Edited by Sean Cosgrove Friday, September 02, 2011 4:30 PM