Hello.
This code displays query results in a listbox:
This code is in the double click event for the listbox:
This is in the detallesfrm form:
The list gets populated fine, but when I double click on any line, the form "detallesfrm" opens in "new record" mode. I added the msgbox you see in the code to see if the [ID] value was getting passed on and all I get is a blank message box.
Anyone knows why?
mafhobb
This code displays query results in a listbox:
Code:
Private Sub cmdSearch_Click()
' Original Procedure
' please note that the first part of the search (for txtsearch or box 1 in the form) is done directly in the query SearchCustomertxt
Me.lstSearch.RowSource = "Select [ID], [ISBN], [Title], [Author], [Category], [Editorial], [Read], [Bueno]" & _
"From [QrySearchBooks]" & _
"Where [ID] like '*" & Me.txtSearch2 & "*'" & _
"OR [ISBN] like '*" & Me.txtSearch2 & "*'" & _
"OR [Title] like '*" & Me.txtSearch2 & "*'" & _
"OR [Author] like '*" & Me.txtSearch2 & "*'" & _
"OR [Editorial] like '*" & Me.txtSearch2 & "*'" & _
"OR [Category] like '*" & Me.txtSearch2 & "*'" & _
"OR [Read] like '*" & Me.txtSearch2 & "*'" & _
"OR [Bueno] like '*" & Me.txtSearch2 & "*'" & _
"Order By Not IsNull([Title]), [Author], [Editorial];"
Me.lstSearch.Requery
Me.txtcount = Me.lstSearch.ListCount
Exit Sub
End Sub
This code is in the double click event for the listbox:
Code:
Private Sub lstSearch_DblClick(Cancel As Integer)
If IsNull(Me.lstSearch) Or Me.lstSearch.Value = "" Then
MsgBox "Ningun libro seleccionado."
Exit Sub
End If
Dim stDocName As String
Dim stLinkCriteria As String
' Procedure
stDocName = "Detallesfrm"
stLinkCriteria = "[ID]=" & Me![lstSearch]
MsgBox ID
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
End Sub
This is in the detallesfrm form:
Code:
Private Sub Form_Open(Cancel As Integer)
If Me.OpenArgs <> "" Then
With Me.[Detallesfrm].Form
.Filter = "[ID]=" & Me.OpenArgs
.FilterOn = True
End With
End If
End Sub
The list gets populated fine, but when I double click on any line, the form "detallesfrm" opens in "new record" mode. I added the msgbox you see in the code to see if the [ID] value was getting passed on and all I get is a blank message box.
Anyone knows why?
mafhobb