Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    New Lounger
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    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.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    New Lounger
    Join Date
    Sep 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It is a new command that is available in Access 2010 VBA and as a macro. I found http://blogs.office.com/b/microsoft-...ro-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
    Last edited by Sean Cosgrove; 2011-09-08 at 12:18. Reason: typo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •