The "Enter Parameter Value" window pops up

Rohdester

New member
Local time
Today, 19:54
Joined
Jan 3, 2005
Messages
6
I'm an Access newb in need of some help! :cool:

I have a list box which lists names of companies. I'd like to be able to double click a name and then the event handler should open up the correct form for the company. The event handler of the list box is (I know the naming is bad but this is only for some testing and thus not for production):

Code:
Private Sub List3_DblClick(Cancel As Integer)
    Dim stDocName As String
    Dim stLink As String
    stDocName = "Companies"
    stLink = Me!List3.Value
    
    If IsNull(stLink) Then
        MsgBox "Please double click on a company name."
        Exit Sub
    End If
    
    stLink = "[Company]= " & Me!List3.Value
    DoCmd.OpenForm stDocName, , , stLink
    
End Sub

What happens though is that the "Enter Parameter Value" window pops up when I double click a name in the list box. If I then enter the company's name in this window, the correct form opens. Why does this window pops up?
 
Last edited:
List box

Does this work?

Private Sub List3_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLink As String
stDocName = "Companies"
stLink = Me!List3.Value

If IsNull(stLink) Then
MsgBox "Please double click on a company name."
Exit Sub

Else
End If

stLink = "[Company]= " & Me!List3.Value
DoCmd.OpenForm stDocName, , , stLink

End Sub
 
R,

What's the RowSource of the ListBox? I bet you have more than one
column.

If you have "Select a, b, c From Table ..."

If b is your company name, you need to reference it as:

Me.List3.Column(1) <-- They start at 0

Also, since you say company NAME, you need:

stLink = "[Company] = '" & Me!List3.Column(1) & "'"

Wayne
 
Thanks for your input. It helped and fixed it! ;) ;)

This was what fixed it:

stLink = "[Company] = '" & Me!List3.Column(1) & "'"
 

Users who are viewing this thread

Back
Top Bottom