Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004

    Lightbulb Unanswered: Problem with navigation button

    I have form which has "cmdSearch" on it so the user can find the customer by serching. I also have created my own navigation button to navigate thru records.

    This is the problem: I Have 8 records which i can navigate thru my navigation button but when i do search button and when search button opens the record that i search for i'm not able to use my "cmdPrevious" and "cmdNext" navigation. Any idea why its happaning ? This is the code i use to do search.

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmMain"

    If IsNull(Me.cboSearch) Then
    MsgBox "Please pick the Name from the drop down list"
    stLinkCriteria = "[CustID]=" & Me![cboSearch]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.Close acForm, "frmLogon", acSaveNo
    DoCmd.Close acForm, "frmSearch"
    End If

  2. #2
    Join Date
    Apr 2004
    outside the rim
    If your nav buttons are on the form you are opening, then the problem is that once you have opened the form with the link criteria, the form is filtered to only show that 1 record. Hence, there is no previous or next (unless there is more than 1 record with a matching CustID).

    If you want to open the form and jump to the matching record, but still have the rest of the records available (which it sounds like you want to) then you have a little bit of leg work.

    First, to make the rest of the records available, use the command
    Me.FilterOn = False
    This will show all the records, but also move the focus to the first record, so if you want the visible movement to the user to be according to the nav button pressed, you'll have to return the the record that was selected active and then move.

    An alternate way to do it is to place your connection string into the "OpenArguments" which is the last parameter of the OpenForm command.

    In the form, place in the "OnOpen" event some code that checks to see if there is something sitting in the OpenArgs property and if so, move to that record. That way, you nav buttons will functions as normal.

    This sounds more like what you want.

    Have fun

Posting Permissions

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