Cause Click event to occur

  • Thread starter Thread starter Patrick Graham
  • Start date Start date
P

Patrick Graham

I have a click event for a combo box which lists client
names, once clicked it pulls that clients record.

I have another Combo box that acts a filter changing the
list in the client combo box using code.

After implementing the filter by code I want the first
item in the combobox to be selected which I do with this:

Me.lbxClientLkUp = Me.lbxClientLkUp.ItemData(0)

But that alone does load the record, so I have the wrong
record displayed.

How can I make the record load?
 
hmmm

I suppose I could do this:

Dim rs As Object
Set rs = Me![subIPS].Form.Recordset.Clone
rs.FindFirst "[IPSID] = " & Me.lbxClientLkUp.Column(1)
If Not rs.EOF Then Me![subIPS].Form.Bookmark = rs.Bookmark
rs.Close

which I suppose has some benefit of reducing the # of
records held in memory but I would have to run several
codes like this for various subforms.

What I orginally was thinking of was to "call a click
event" from the filter combo box click event. This called
event uses key data in the combobox to find the correct
record. But how to call the click event?
 
Hi Patrick

The AfterUpdate event of the first combo (where you select the filter)
should set the RowSource and the Value of the second combo. For example:

With lbxClientLkUp
.RowSource = "Select ClientID, ClientName from Clients " _
& "where ClientRegion=" & cboSelectRegion
.Value = .Itemdata(0)
End With
 
Yes but does setting the value of the the 2nd combobox
cause a click event for the 2nd combobox, I dont think so.

BUT if I move that code to afterupdate instead of click
would that cause it to run?

Really what I want is something like

Docmd.Event Me.cbxclientLkUp.Click

which would essentially mean, run the click event code
for the cbxclientLkUp control. Does anything like that
exist? Or is my first suggestion more likely to work?
-----Original Message-----
Hi Patrick

The AfterUpdate event of the first combo (where you select the filter)
should set the RowSource and the Value of the second combo. For example:

With lbxClientLkUp
.RowSource = "Select ClientID, ClientName from Clients " _
& "where ClientRegion=" & cboSelectRegion
.Value = .Itemdata(0)
End With

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

I have a click event for a combo box which lists client
names, once clicked it pulls that clients record.

I have another Combo box that acts a filter changing the
list in the client combo box using code.

After implementing the filter by code I want the first
item in the combobox to be selected which I do with this:

Me.lbxClientLkUp = Me.lbxClientLkUp.ItemData(0)

But that alone does load the record, so I have the wrong
record displayed.

How can I make the record load?


.
 
Back
Top