[AccessD] Setting Combobox to Last Item

David Emerson newsgrps at dalyn.co.nz
Tue Aug 14 21:24:47 CDT 2007


Thanks Mark.  Your suggestion lead me to solve the problem:

Me!cboFinModelDate = 
[Forms]![frmFinModel]![cboFinModelDate].[ItemData](intFinModelCount) 
needed to be changed to
Me!cboFinModelDate = Me!cboFinModelDate.ItemData(intFinModelCount)

It seems that the square brackets caused the problem.

David

At 15/08/2007, you wrote:
>I would check to see what value intFinModelCount is returning, or what
>type...integer or text?...because  (assuming we're talking about 1 form)...
>Me!cboFinModelDate = Me!cboFinModelDate.ItemData(intFinModelCount)
>
>should work.
>
>Good Luck,
>
>Mark A. Matte
>
>
>
>
> >From: David Emerson <newsgrps at dalyn.co.nz>
> >Reply-To: Access Developers discussion and problem
> >solving<accessd at databaseadvisors.com>
> >To: accessd at databaseadvisors.com
> >Subject: [AccessD] Setting Combobox to Last Item
> >Date: Tue, 14 Aug 2007 14:38:36 +1200
> >
> >I want to open a form and set a combo box to the last item in the
> >list (the list is based on a table so the last item isn't static).
> >
> >On the Form open event I have:
> >
> >      intFinModelCount = (basRunDataObject("SELECT FinModelID FROM
> >dbo.tblFinModel", adCmdText).RecordCount) - 1
> >      If intFinModelCount > 0 Then
> >          Me!cboFinModelDate =
> >[Forms]![frmFinModel]![cboFinModelDate].[ItemData](intFinModelCount)
> >'Error here
> >      End If
> >
> >The error I get is 450 - Wrong number of arguments or invalid
> >property assignment.
> >
> >Any pointers on where I might be wrong?
> >
> >Regards
> >
> >David Emerson
> >Dalyn Software Ltd
> >Wellington, New Zealand
> >
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
>
>_________________________________________________________________
>Booking a flight? Know when to buy with airfare predictions on MSN Travel.
>http://travel.msn.com/Articles/aboutfarecast.aspx&ocid=T001MSN25A07001
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com




More information about the AccessD mailing list