473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search from listbox

1 New Member
Hi folks, and congratulations on your forum.

I have a problem when using a List Box to search a DB. The query below populates my list box using a search criteria, this works fine.
Expand|Select|Wrap|Line Numbers
  1. SELECT Clientes.Cliente, Clientes.Molde, Clientes.Estantería, Clientes.Fecha, Clientes.Orden FROM Clientes WHERE (((Clientes.Cliente) Like ([Forms]![BUSCAR_FRM]![txtSearchString])+"*"))
  2. ORDER BY Clientes.Cliente;
The problem is that when I double click the record desired it goes to the first record of the recordset for that client instead of going to the actual record. The keyID field in the table is "Orden" (which displays on the ListBox on the 5th column). Check code below.
Expand|Select|Wrap|Line Numbers
  1. Private Sub ListaCliente_DblClick(Cancel As Integer) On Error GoTo Err_ListaCliente_DblClick
  2.  
  3. Dim stDocName As String
  4. Dim stLinkCriteria As String
  5.  
  6.     stDocName = "Clientes"
  7.     stLinkCriteria = "[Cliente]=" & "'" & Me![ListaCliente] & "'"
  8.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  9. Exit_ListaCliente_DblClick:
  10. Exit Sub
  11.  
  12. Err_ListaCliente_DblClick:
  13. MsgBox Err.Description
  14. Resume Exit_ListaCliente_DblClick
  15. End Sub
I have limited knowledge of VB and would appreciate any help.

Thanks Clive
Jun 8 '06 #1
2 2298
mjf1
1 New Member
Hi there. Don't know if you are the same Clive Ellul who used to live in North London and pal about with Eric there. If so, you may remember me, Moray (Scottish bloke) from way back in the day (way back!). If not, sorry to have troubled you!!!
May 8 '09 #2
ADezii
8,834 Recognized Expert Expert
@Clive Ellul
Try, assuming [Orden] is Numeric:
Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String 
  2. Dim stLinkCriteria As String 
  3.  
  4. stDocName = "Clientes" 
  5.  
  6. stLinkCriteria = "[Orden]=" & Me![ListaCliente].Column(4) 
  7.  
  8. DoCmd.OpenForm stDocName, , , stLinkCriteria
May 12 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2312
by: Ben | last post by:
I've got an asp page that populates a listbox with info from a db. The list box ends up being pretty big, so I want to be able to search it effectively. I like the method wherein the user types...
1
1596
by: damjanu | last post by:
Dear All; I have 3 issues 1) On some of my tables I have unique indexes, so that for example no two phone numbers can be the same. When user enters phone number that already exists, a scary...
0
1805
by: Colleyville Alan | last post by:
I have an app that looks up an id number and when a button is clicked, inputs the id # into a query. After running the query, I click a second button which grabs the client name rather than the id...
3
3424
by: Colleyville Alan | last post by:
I have a incremental search box that has been working fine for a couple of months but is now acting up. This search box is from the cd that comes with Getz's book, so I did not write it and have...
15
49336
by: allansiu823 | last post by:
Hi I am new to MS Access and VBA and have been bothered by this problem for a looooong time. I have this listbox containing all the records (~1000) in a form and I want to be able to type something...
1
1884
by: tonsam | last post by:
I have a form (stockcard) and I'm planning to create a search form(stock_search) with a listbox(stock_listbox) that will only be visible upon a click of the button. In the said listbox I will choose...
16
2824
by: Computer geek | last post by:
Hello, I am new to VB.NET and programming in general. I have taught myself a lot of the basics with vb.net but am still quite the novice. I am working on a little application now and I need some...
0
1337
by: noobkuku | last post by:
Guys i got this error i don know how to slove it anyone can enlighten me? http://i15.tinypic.com/4ztjzas.jpg Private Sub search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)...
10
3942
by: Eugenio | last post by:
Hi there, I'm returning to this forum for the second time and I would like to say thanks for the great help provided. I've encountered a new problem now and hope that you will be able to help me...
9
10654
by: weirdguy | last post by:
Hello, Just for anyone information, there is a similar title "Search in Listbox" but it is via Combo Box. In case, anyone need it, I put a link to here. Please let me know if I break any rules...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
399
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.