command link problem (1 Viewer)

bauer

Registered User.
Local time
Today, 12:59
Joined
Aug 23, 2001
Messages
77
I have already searched around in this forum for the answer, but I haven't been able to find anything. I now turn to you all, and hope and pray there is an answer out there.

I have a command button that I use to open a form with criteria coming from a combo box on my form. Most of the time this works beautifly. However, there are times when access just wigs out and decides not to go to the specified record, but rather to the first record, and the user has to scroll through to find the one they are looking for.

I am 99.99999...% sure that there is not a problem with my code (as it works correctly most of the time). I personnally think that it is a "feature" of access.

If anyone has any insight on this discovery of mine, I would appreciate it. As for all I know it probably is something that I meesd up.

So, I thank you all in advance, as I am quite stummped on this.
 

bauer

Registered User.
Local time
Today, 12:59
Joined
Aug 23, 2001
Messages
77
The following is the onClick event. there is a drop down box called cmdEvent, which has the primary key to the records that the form "Events" is based on.

Code:
Private Sub cmdOpenEvent_Click()
On Error GoTo Err_cmdOpenEvent_Click

    'check to see if the user selected an item in the list
    If Not IsNull(Me![cmbEvent]) Then
        Dim stDocName As String
        Dim stLinkCriteria As String
    
        stDocName = "Events"
        
        stLinkCriteria = "[EventID]=" & Me![cmbEvent]
        DoCmd.OpenForm stDocName, , , stLinkCriteria
    Else
        MsgBox "You must select an Event first"
    End If
    
Exit_cmdOpenEvent_Click:
    Exit Sub

Err_cmdOpenEvent_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpenEvent_Click
    
End Sub[code]

Thank you
 

Users who are viewing this thread

Top Bottom