Solved

field names from RowSource SQL statement

Posted on 2009-07-08
5
417 Views
Last Modified: 2012-05-07
Hello.

I need to get the field names from the SQL statement which fills the Rowsource of a listbox.  I don't want to make a trip to the database to do this.   Any ideas would be appreciated.

Thanks.
0
Comment
Question by:mdcadu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Alan_White
ID: 24805292
Well you can get the full SQL query by referencing the rowsource property
 
eg msgbox (theFieldYouWant.rowsource)
Any help?
0
 

Author Comment

by:mdcadu
ID: 24805419
I think i need to give a little more information on what i am trying to do.  It may not be as straightforward as I originally thought.

I have a set of controls on a form that are enabled/disabled based on a parameter value when the form opens.  I fill a listbox on that form with the saved data from the controls.  The display in the listbox is built based on the enabled/disabled controls, so that only the data matching the input parameter is displayed.  So, the user sees a series of enabled controls and then sees the matching values in the listbox below.

When editing, I want to access the listbox and fill the enabled controls with the matching values from the listbox.  I have made the control names exactly the same as the field names in the table which feeds the SQL statement for the listbox Rowsource.

What I want to do is walk through the selected row in the listbox and, for each field name, get the value and put in the matching enabled control.  What i need to know is how to query the Rowsource so that the first column returns a name of "Section", the second gives me "Township", etc.

listbox.rowsource."getFieldName", os somethign similar.  the part that i don't know how to do is the "getFieldName."

Sorry for thhe poorly worded original post.  After i did more digging, it looked like this wasn't as easy as i had thought it would be.

Thanks.
0
 

Author Comment

by:mdcadu
ID: 24805432
i forgot to increase the points value, too.
0
 
LVL 10

Accepted Solution

by:
Alan_White earned 500 total points
ID: 24805536
It is not just a matter of writing a bit of code to parse the string returned from list.rowsource to identify each element?
0
 

Author Closing Comment

by:mdcadu
ID: 31601211
Doing that will give me the field names and I will know then exactly where they are positioned in the table, so I can correlate the selected row column values with the correct field name and put in the enabled controls above.  This wouldn't be so convoluted, except that the fields have the capability of changing each time the form opens, depending on the value of the input parameter.

Thanks for the help!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

691 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