Move column in vba?

wtrimble

Registered User.
Local time
Today, 08:55
Joined
Nov 13, 2009
Messages
177
Hello, I have a query shown in datasheet view as a subform. The table consists of a sample number field and chemical element fields. On my form I have a combobox that filters the query by a certain chemical and a range.

Is it possible to move the column that the user is filtering for to the second column so the user can quickly see the values for that column?? I would I also need them to reset after the user closes the form.

Thanks for any help
 
If you're talking about the way that the query is displayed, I'd probably change the subform's recordsource, i.e. change the order in which fields are shown in the SELECT statement.
 
Hmm, will changing the order of the RecordSource change the order of what is displayed?
 
Oh the order - sorry, I thought you meant move a column. There is an order by property but I'm not sure if it applies to queries in subforms - maybe just forms in subforms. But yes, requerying and adding an ORDER BY in the SQL string will do that for you.
 
Sorry I did mean moving a column. I'll try that out... seems a little time extensive though
 
Good luck! I can't think of a way to programatically change the order of the columns, sorry....
 
Changing the order on the subform recordsource (on load) doesn't seem to change the order of the columns..
 
So
Code:
SELECT a, b
comes out the same as
Code:
SELECT b,a
?
 
However the user last changed the columns is how it will appear no matter if you're sql says differently
 
New one on me... it should come out in the order you SELECTed. Sorry, out of ideas then!
 
Wicked! My favourites are piling up fast!
 
I guess columnorder is the one you're after OP!
 
Yes it appears to be. About to try it out. Thanks for the help
 

Users who are viewing this thread

Back
Top Bottom