Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combobox click simulation

Posted on 2000-03-19
8
Medium Priority
?
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 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 70

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:fordraiders
ID: 2633641
emoreau,
Both are showing
cboNoun.List(cboNoun.ListIndex)  = ""
cboMod.List(cboMod.ListIndex)  = ""
fordraiders
0
 
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 70

Expert Comment

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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

715 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