[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

field names from RowSource SQL statement

Posted on 2009-07-08
5
Medium Priority
?
419 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 1500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

649 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