• using where condition of DoCmd.BrowseTo with navigation form (Access 2010)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » using where condition of DoCmd.BrowseTo with navigation form (Access 2010)

    Author
    Topic
    #478773

    I now can successfully get Access to open the navigation formto the correct tab using DoCmd.BrowseTo.

    Code:
    DoCmd.BrowseTo acBrowseToForm, “frmGuestInfo”, “Main.NavigationSubform”, “[GuestID] = ” & lngGuestID 

    The secret was that I had to close the search form that was in use, so that the already open navigation form, “Main”, would be visible, or the active form.

    However, I cannot get the where condition to work at all. It has been some years since I worked with Access, so I’m sure I’m probably missing something simple, but I have tried many variations of ways to specify the where condition. I was able to specify a filter on the form in question, frmGuestInfo, that worked as expected, but the same filter did not work when specified as the where condition of the DoCmd.BrowseTo command. lngGuestID does evaluate in code properly, so that is not the problem.

    Please let me know if you have any ideas.

    Regards,

    Sean

    Viewing 1 reply thread
    Author
    Replies
    • #1296296

      Well, that was weird and frustrating. It turns out the form being used as the subform in question was corrupt. Today Access crashed if I tried to open the VBA editor, and if I imported that form to a new blank database. I imported eveything else and recreated the form. I did not suspect that the code the past few days would appear to work in general, but somehow mysteriously ignore the where condition of the browseto command.

      I continued working on my search code, using the exact same command for a different situation, and it worked perfectly! Then I uncommented the where condition from the line of code that was not working, and it also worked as expected. Very strange.

      I am a little concerned that something in Access has corrupted given that I have a fresh install of Office 2010 and Windows 7, and have only been designing a database for a short time on it. There are a few peculiarities to my current setup, which shouldn’t (but might) have caused a problem. I am currently using a trial version of Windows and Office, and am running them on a virtual machine.

      Hope this doesn’t happen to someone else, but hopefully this will help when it does.

      Sean

      • #1296926

        This is a new a new one for me. What does the BrowseTo method actually do? I looked at Access Help, but that function has not been particularly useful since Access2003.

    • #1296973

      It is a new command that is available in Access 2010 VBA and as a macro. I found http://blogs.office.com/b/microsoft-access/archive/2010/02/23/access-2010-browseto-docmd-and-macro-action.aspx helpful, even though the writer was talking about the macro. In Access 2010 it is especially helpful for use with the new navigation control. In my case I used it the BrowseTo command from a pop up search form to navigate to a specific record on my main navigation form, using the where condition.

      Albert Kallal has some posts about the command, and a video at http://www.youtube.com/watch?v=AU4mH0jPntI demonstrating his use of the navigation control.

      Regards,
      Sean Cosgrove

    Viewing 1 reply thread
    Reply To: using where condition of DoCmd.BrowseTo with navigation form (Access 2010)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: