Solved

Combobox click simulation

Posted on 2000-03-19
8
393 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 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

23 Experts available now in Live!

Get 1:1 Help Now