Solved

Combobox click simulation

Posted on 2000-03-19
8
389 Views
Last Modified: 2013-12-25
I'm posting text to a combobox from a textbox during an  event on a cmdNext (Navigation button).
I have a click event firing when a selection is made in this combobox.(If I manually click in the combobox)
After the text is placed in the combobox is there anyway to simulate a click event to recognize the value in the combobox?
To simulate picking the text.
Thanks
fordraiders
0
Comment
Question by:fordraiders
  • 4
  • 4
8 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 2633294
You can simply call "Combo1_Click" since it is also a regular procedure.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2633560
emoreau,
The comboxes seem to be working.
However the events in the click event do
not seem to be firing.
I have a drill down sequence on both comboxes and after the click event in the second combobox a datagrid is being filled.
None of this is happening.
1. combox
 Private Sub cboNoun_Click()
    Dim db As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim sql As String
    'Me.Command2.Enabled = False
    Me.cboMod.Clear
   
    With db
        .CursorLocation = adUseClient
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source =c:\program files\cribture\data\nomad.mdb"
        .Open
    End With
    sql = "Select * from ndxNounsModifiers where noun = '" & cboNoun.List(cboNoun.ListIndex) & "'"
                   
    With rs
        .Open sql, db
    End With
    Do Until rs.EOF = True
        cboMod.AddItem rs.Fields("modifier").Value
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    db.Close
    Set db = Nothing

End Sub


2. second Combox
Private Sub cboMod_Click()
Dim cnNN As ADODB.Connection
Dim rsTT As ADODB.Recordset
Dim STRCNN As String
Dim STRSQL As String
Dim tgValue As String
Dim x As String
x = "LENGTH"
Me.Command2.Enabled = True

' provide jet connection
    STRCNN = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source =c:\program files\cribture\data\nomad.mdb"
    Set cnNN = New ADODB.Connection
cnNN.Open STRCNN
    ' hook it all up guys new code from one table  nomad  stuff
    STRSQL = "Select Attribute, Value from ndxAttributes " & _
          "where noun = '" & cboNoun.List(cboNoun.ListIndex) & _
          "' and modifier = '" & cboMod.List(cboMod.ListIndex) & "'"
 Set rsTT = New ADODB.Recordset
    With rsTT
        .ActiveConnection = cnNN
        .CursorLocation = adUseServer
        .CursorType = adOpenKeyset
        .LockType = adLockOptimistic
        .Open STRSQL, , , , adCmdText
    End With
 
 Set Adodc3.Recordset = rsTT
 Set DataGrid1.DataSource = Adodc3.Recordset
 DataGrid1.Columns(0).Locked = True
 
 
 'PLACE A BUTTON IN THE CUSTYPE COLUMN
 DataGrid1.Columns(1).Button = True
 
END SUB



any suggestions?
fordraiders
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2633618
Place breakpoints in your events and check for the value inside:
cboNoun.List(cboNoun.ListIndex)
cboMod.List(cboMod.ListIndex)
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2633641
emoreau,
Both are showing
cboNoun.List(cboNoun.ListIndex)  = ""
cboMod.List(cboMod.ListIndex)  = ""
fordraiders
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Author Comment

by:fordraiders
ID: 2633644
emoreau,
Both are showing
cboNoun.List(cboNoun.ListIndex)  = ""
cboMod.List(cboMod.ListIndex)  = ""

(cboNoun.ListIndex) both are showing -1
(cboMod.ListIndex)

fordraiders
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2633670
This is because you have nothing chosen in these combos!
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2633672
Since it is a combo box, you can use cboNoun.text (instead of cboNoun.List(cboNoun.ListIndex))
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2633941
emoreau,
Thanks
a million.
This has got me going!!!!
I still have other questions about the datagrid.
But that's another question!

I had this working using code from the rad tool appication.
But I needed to the combox bound to another recordset and the only way I knew to do this was to faked the combox into thinking I typed something into it.
To sort of sync the application from past values chosen.
Thanks again
Learned alot
fordraiders
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now