Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting data from MS Access table columns based on column location instead of column names

Status
Not open for further replies.

rashokku

Programmer
Nov 27, 2017
3
US
Let us I have a table name "Patient" in MS Access database and the table has following columns.

Member_ID (First Column)
Member_Name (Second Column)
Member_DOB (Third Column)
Member_Address (Fourth Column)
Member Zip (Fifth Column)

I would like to select the columns based on the column location/number/sequence than the column name.

What is the syntax in SQL to locate the column location?

Thanks for your help.
Ram

 
We have health plan data file that need to be imported in to MS Access table. The column header names keeping changing or not constant/fixed
but the column location/sequence/order is fixed. So, instead of selecting/reading the columns by column names/header names, I would like
to read the columns by column number/column locations and import it into exsiting table or drop existing table & create new table.

Please see the attachment for example.




11-28-2017_11-24-41_AM_veuqmu.png
 
I don't believe there is any way to do this with pure Access SQL. I expect you would need to write a bit of DAO code to create a query.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
How do you do it now?
Do you have an MS Query that connects to Excel like:

[tt]SELECT Member_ID, Member_Name, Member_DOB, Member_Address, Member Zip
FROM Sheet1[/tt]

And that's why you need to know the names of the columns in Excel?


---- Andy

There is a great need for a sarcasm font.
 
Hi,

What’s the reason for such a requirement?

That might help us help you.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Can you do some preprocessing: open excel file with vba automation, rename headers (if you are sure that required data has headers and the order is fixed), save file and import data?

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top