Henry Simpson
hsimpson88 at hotmail.com
Thu Jul 10 00:43:16 CDT 2003
Jurgen Welz once showed me how to do this. If you use a callback to fill the combo from an array you fill with GetRows from a recordset or by some other means, you can determine the highlighted item. In the call back function posted here, the debug print yeilds the index of the item that can be used to return the data highlighted. mlngI was a form module level variable that held the number of elements in the array and marDocNames was a two dimensional array of data. Function Documents(fld As Control, ID As Variant, Row As Long, Col As Long, Code As Variant) _ As Variant 'Callback function for filling list/combo from array Dim ReturnVal As Variant Static lng As Long ReturnVal = Null Select Case Code Case acLBInitialize ReturnVal = mlngI Case acLBOpen ReturnVal = Timer Case acLBGetRowCount ReturnVal = mlngI Case acLBGetColumnCount ReturnVal = 3 Case acLBGetColumnWidth ReturnVal = -1 Case acLBGetValue ReturnVal = marDocNames(Col, Row) mlngListRow = Row If Col = 0 Then Debug.Print Row Case acLBGetFormat Case acLBEnd End Select Documents = ReturnVal End Function Hen >From: "Stuart McLachlan" <stuart at lexacorp.com.pg> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >Subject: Re: [AccessD]ComboBox Values >Date: Thu, 10 Jul 2003 12:17:36 +1000 > >Nothing I've been able to find anywhere. > >It looks like when they built the Access version of a combobox, they >built in a non-standard behaviour for the listbox part of the control >and didn't include any way to access the highlighted item. > >It seems the highlighting when scrolling during a mousemove over the >list portion of the control is a completely internal process of this >sub-class of the standard Windows combobox control. > > > > On 9 Jul 2003 at 21:58, Susan Harkins wrote: > > > Have you tried any of the mouse events? I'm not sure there's an >appropriate > > one, but... > > > > Susan H. > > > > > > > Darren, > > > > > > Correct...it is in DropDown Mode...but I can't get the value when the > > mouse > > > changes the highlighted value...only when the arrow keys are used to >move > > to > > > the next value...I will let you know if I figure the mouse out...but >for > > > now...I used the onchange event and the .SelText property...ex: > > > > >-- >Lexacorp Ltd >http://www.lexacorp.com.pg >Information Technology Consultancy, Software Development,System Support. > > > >_______________________________________________ >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail