Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2005

Tip: Looking for answers? Try searching our database.

Syntax for combo box column item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KitCaz - 03 May 2005 22:46 GMT
I've referred to a combo box's primary column in a query before
([Forms]![FormName]![ComboBoxControl]) but not with a column other than the
primary one.  What is the syntax?  E.g., I want to refer to column 7 but
these syntaxes are failing in one way or another:

[Forms]![FormName]![ComboBoxControl].(6)
[Forms]![FormName]![ComboBoxControl]!(6)
[Forms]![FormName]![ComboBoxControl].[6]

I'm sure i'm almost there, right? :)
Allen Browne - 03 May 2005 22:54 GMT
The syntax would be:
   [Forms]![FormName]![ComboBoxControl].Column(6)

But no guarantees that this will work as expected in the context of a query.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I've referred to a combo box's primary column in a query before
> ([Forms]![FormName]![ComboBoxControl]) but not with a column other than
[quoted text clipped - 7 lines]
>
> I'm sure i'm almost there, right? :)
KitCaz - 03 May 2005 23:08 GMT
I'm getting:

undefined function '[Forms]![FormName]![ComboBoxControl].Column' in expression

AGH!

> The syntax would be:
>     [Forms]![FormName]![ComboBoxControl].Column(6)
[quoted text clipped - 12 lines]
> >
> > I'm sure i'm almost there, right? :)
Allen Browne - 04 May 2005 03:29 GMT
Yes, that sounds familiar when you try that in a query.

Whatever table serves as the RowSource for the query, try adding that table
to the query. You can then specify the criteria under the actual field from
that table instead of having to try to read the Column of the combo.

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I'm getting:
>
[quoted text clipped - 21 lines]
>> >
>> > I'm sure i'm almost there, right? :)
KitCaz - 04 May 2005 11:48 GMT
I can see the value of your suggestion.  In this case, though, I do need to
refer to the combo box column because I need to know what choice the user has
made in that control.

Van T. Dinh's suggestion worked like a charm in this case.  Thank you very
much for your help!

> Yes, that sounds familiar when you try that in a query.
>
[quoted text clipped - 27 lines]
> >> >
> >> > I'm sure i'm almost there, right? :)
Van T. Dinh - 04 May 2005 03:59 GMT
Try:

   Eval("[Forms]![FormName]![ComboBoxControl].Column(6)")

in Query / SQL.  This assumes that the Form and Column 7 of the selected row
in the ComboBox has a valid value.

HTH
Van T. Dinh
MVP (Access)

> I'm getting:
>
> undefined function '[Forms]![FormName]![ComboBoxControl].Column' in expression
>
> AGH!
KitCaz - 04 May 2005 11:48 GMT
Just the thing I needed!  Thanks!

> Try:
>
[quoted text clipped - 13 lines]
> >
> > AGH!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.