473,836 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[VB6] combo to search change - can't figure it out

for your info - I'm a newbe.
Code is at the bottom.
Access dbase (each form ca. 10 KB) if my explanations are not enough
(probably they aren't).

-- access 97 - http://www.lokalny.net/Source97.zip
-- access 200 - http://www.lokalny.net/Source2000.zip

------
Im trying to change code - just trying to learn something. But nothing seems
to work.
Advice, hint ... anything would be helpfull.

Current situation:
-- after picking an option from a combo box (cboList), that option is being
shown in list box (lstInfo)
-- after clicking that new entry in (lstInfo) data is being distributed to
several text boxes.

What I'm trying to accomplish:
-- comboBox (cboList) - gone,
-- txtBox instead for entering a string and searching (say) xType column in
database
-- search results displayed in list box (lstInfo)
-- upon click on any of these results in list box (lstInfo) data from
recordset should be distributed to text boxes as it is now.

--------------
Here is code:
--------------
Option Explicit

Dim cn As New ADODB.Connectio n
Dim rs As New ADODB.Recordset

Private Sub cboList_Click(I ndex As Integer)
Dim t_Records As Long, t_Counter As Long
txtInfo(0).Text = ""
txtInfo(1).Text = ""
txtInfo(2).Text = ""
lblData(0).Capt ion = ""
'lblData(1).Cap tion = ""
lblData(2).Capt ion = ""
lstInfo.Clear
Label3.Visible = True
With rs

.Open "SELECT ID, xType, xSubType, SearchNote From tblSource Where
tblSource.xType = '" & cboList(0).Text & "' ORDER BY xSubType;"
If Not .EOF Then
lstInfo.Clear
t_Records = .RecordCount
For t_Counter = 1 To t_Records

lstInfo.AddItem .Collect(2) & " (" & Left(.Collect(3 ),
100) & ") ........"
lstInfo.ItemDat a(lstInfo.NewIn dex) = .Collect(0)
.MoveNext
Next t_Counter
End If
If .State = adStateOpen Then .Close
End With
End Sub

Private Sub Command1_Click( )
Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo errH

Dim strPath As String
strPath = App.Path & "\Source.md b"
With cn
.Open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=" & strPath &
";Persist Security Info=False"
End With

With rs
.ActiveConnecti on = cn
.CursorType = adOpenKeyset
.LockType = adLockOptimisti c
End With
With tmData
.Interval = 123
.Enabled = True
End With
Exit Sub
errH:
If Err.Number = -2147467259 Then
MsgBox "Data file not found, ensure that the data file is in the " &
strPath & " directory " & vbCrLf & "This form will unload now", vbCritical,
"NBS Solutions"
Unload Me
Exit Sub
Else
Resume Next
End If
End Sub
Private Sub loadCAT()
With rs
.Open "SELECT DISTINCT xType From tblSource ORDER BY
xType;"
If Not .EOF Then
cboList(0).Clea r
Do While Not .EOF
cboList(0).AddI tem .Collect(0)
.MoveNext
Loop
End If
If .State = adStateOpen Then .Close
End With
End Sub
Private Sub loadInfo()
With rs
.Open "SELECT ID, xType, xSubType, xCode, xDeclarations,
xDescription, xNote, xRefrences FROM tblSource" _
& " WHERE ID =" & lstInfo.ItemDat a(lstInfo.ListI ndex) & ""

If Not .EOF Then
txtInfo(0).Text = .Collect(4)
txtInfo(1).Text = .Collect(3)
txtInfo(2).Text = .Collect(6)
lblData(0).Capt ion = .Collect(5)
lblData(2).Capt ion = .Collect(7)
End If
If .State = adStateOpen Then .Close
End With
End Sub
Private Sub Form_QueryUnloa d(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub lstInfo_Click()
loadInfo
End Sub

Private Sub tmData_Timer()
tmData.Enabled = False
tmData.Interval = 0
loadCAT
End Sub



Nov 21 '05 #1
3 1525
"Jeff" <ze****@opYAKNO WWHATTODO.pl>'s wild thoughts were
released on Wed, 29 Dec 2004 22:06:27 +0100 bearing the
following fruit:
for your info - I'm a newbe. Code is at the bottom.
Access dbase (each form ca. 10 KB) if my explanations are not enough
(probably they aren't).

-- access 97 - http://www.lokalny.net/Source97.zip
-- access 200 - http://www.lokalny.net/Source2000.zip

------
Im trying to change code - just trying to learn something. But nothing seems
to work.
Advice, hint ... anything would be helpfull.

<SNIP>

People tend to avoid answering questions that have been
crossposted to too many groups and even more so when it has
been posted to group(s) in which the question is off topic.

Jan Hyde (VB MVP)

--
Incest is relatively boring. Necrophillia is dead boring. (Hugh Janus)

[Abolish the TV License - http://www.tvlicensing.biz/]

Nov 21 '05 #2
thank You for a hint.
This is a first time I use usenet also :)
So no hard feelings ppl
Don't cuss to hard.
Peace ...
"Jan Hyde" <St***********@ REMOVE.ME.uboot .com> wrote in message
news:0p******** *************** *********@4ax.c om...
"Jeff" <ze****@opYAKNO WWHATTODO.pl>'s wild thoughts were
released on Wed, 29 Dec 2004 22:06:27 +0100 bearing the
following fruit:
for your info - I'm a newbe.

Code is at the bottom.
Access dbase (each form ca. 10 KB) if my explanations are not enough
(probably they aren't).

-- access 97 - http://www.lokalny.net/Source97.zip
-- access 200 - http://www.lokalny.net/Source2000.zip

------
Im trying to change code - just trying to learn something. But nothing seemsto work.
Advice, hint ... anything would be helpfull.

<SNIP>

People tend to avoid answering questions that have been
crossposted to too many groups and even more so when it has
been posted to group(s) in which the question is off topic.

Jan Hyde (VB MVP)

--
Incest is relatively boring. Necrophillia is dead boring. (Hugh Janus)

[Abolish the TV License - http://www.tvlicensing.biz/]

Nov 21 '05 #3
"Jeff" <ze****@opYAKNO WWHATTODO.pl>'s wild thoughts were
released on Thu, 30 Dec 2004 21:43:13 +0100 bearing the
following fruit:
thank You for a hint.
This is a first time I use usenet also :)
So no hard feelings ppl
Don't cuss to hard.
Peace ...
Now, first decide if this is a VB question or a VB.Net
question. Then crosspost to no more than 2 or 3 relevant
groups.

However for VB question I would suggest just posting to

microsoft.publi c.vb.general.di scussion

And for VB.Net questions

microsoft.publi c.dotnet.langua ges.vb

And that is usally enough. If no-one knows the answer they
can direct you to a better group to ask your question in.

"Jan Hyde" <St***********@ REMOVE.ME.uboot .com> wrote in message
news:0p******* *************** **********@4ax. com...
"Jeff" <ze****@opYAKNO WWHATTODO.pl>'s wild thoughts were
released on Wed, 29 Dec 2004 22:06:27 +0100 bearing the
following fruit:
>for your info - I'm a newbe.

>Code is at the bottom.
>Access dbase (each form ca. 10 KB) if my explanations are not enough
>(probably they aren't).
>
>-- access 97 - http://www.lokalny.net/Source97.zip
>-- access 200 - http://www.lokalny.net/Source2000.zip
>
>------
>Im trying to change code - just trying to learn something. But nothingseems >to work.
>Advice, hint ... anything would be helpfull.

<SNIP>

People tend to avoid answering questions that have been
crossposted to too many groups and even more so when it has
been posted to group(s) in which the question is off topic.

Jan Hyde (VB MVP)

--
Incest is relatively boring. Necrophillia is dead boring. (Hugh Janus)

[Abolish the TV License - http://www.tvlicensing.biz/]

Jan Hyde (VB MVP)

--
So I met this gangster who pulls up the back of people's pants, it
was Weggie Kray.

[Abolish the TV License - http://www.tvlicensing.biz/]

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2231
by: Jim | last post by:
Hi, there, I am a beginner on Access. I have been taking so long time to try to figure out his, but so far, no clues. I want to select 2 combo boxes and Access will automatically fill in other 5 bound text fields for me. I searched all groups and microsoft support sites, no result.
2
3067
by: Jeff Barry | last post by:
Hi, I wonder if any one can help, I'm pretty new to Access and I can't figure out how to change the contents of a combo box based on a selection I make in another. Let me explain I have a combo box where I can select a continent from a continent table. I would like the contents of a second combo box to reflect my choice of continent and list countries that are in that continent. These countries are in separate tables/queries (actually...
1
6182
by: Will | last post by:
I have a combo box on a form which is based on table tblMachine. On that combo box I have four columns visible MachineNumber, description, location and type. The bound column is the MachineNumber and this is not set to 0 as the machines have its number on which means the user should know the machine number. My problem is if the user doesn't know the number. I have a button which changes the row source of the combo box to order by...
32
14927
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if ((someString.IndexOf("something1",0) >= 0) || ((someString.IndexOf("something2",0) >= 0) ||
5
1829
by: Col | last post by:
I have a query with criteria that comes from a combo box on a form. I'd like to set the query up so the user can either limit the criteria to the selection in the combo box or the user can pull all records. Can't figure out a way for the query to pull all records. Currently uses the criteria !!. I've tried a couple of things to allow for the option of all records, but without any luck. Any suggestions?
8
8265
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the company and has been flagged inactive. If you have a filter on the rowsource like Where Active = True then Joe's name would not show up in the combo list. This would be fine if the combo is associated with a field that is null/0. It would not be...
0
5578
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
3
3308
by: emily.a.day | last post by:
I have a book database, and I have set up a query to search by subject. As it is now, the searcher has to know the subject and type it into the query. I wonder if there is a way to have a combo box where the searcher can select the subject before running the query, rather than consulting the separate subject list and typing the subject in manually. I have tried sticking the combo box in the report, but can't figure that out. I think...
8
1835
by: troy_lee | last post by:
I want to look at the values of six combo boxes. If any of the boxes are not null, I want to change the value of a separate text box. How can I look at all of them at once? Thanks in advance. Troy Lee
0
9810
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10237
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6972
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4436
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.