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 / June 2007

Tip: Looking for answers? Try searching our database.

Datasheet coding

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandy - 03 Jun 2007 00:51 GMT
Hi
I have a subform that contains a datasheet of imported Excel Data.  When a
user selects a column, I want to store the name of the selected column/field
in a variable. Is this possible or if not, how else could I achieve this.
The purpose is to allow users to import a spreadsheet of data into a temp
table and then select the columns of data they would like to store
permenantly.

Thanks in advance
Sandy
Arvin Meyer [MVP] - 03 Jun 2007 13:40 GMT
They will need to build a query to do that. An Append query, or if the
columns will change, a Make-Table query are the query types that you will
need to teach them to make. There are no events for Associated (attached)
labels. Attached labels are the ones which will show in a datasheet column
header. If there is no attached label, the field name is used for a label on
a datasheet.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hi
> I have a subform that contains a datasheet of imported Excel Data.  When a
[quoted text clipped - 6 lines]
> Thanks in advance
> Sandy
Sandy - 03 Jun 2007 14:08 GMT
Hi Arvin
Thanks for the reply. Not sure whether I am misinterpreting your answer or
you haven't understood my question.  Can I just clarify what I'm doing.

My users have a list box filled with Excel file names that are in a specific
folder on the computer. When they select one of these docs, the entire
spreadsheet is imported into an Access table called tblTempData.  The field
names in this table are Field1,Field2,Field3 etc.
I have this part working.

On the form they are using is a subform/datasheet with the new imported data
displayed.  When a user highlights a column (eg Field1) I would like to
store 'Field1' into a variable. All I need to know is the name of the column
they have highlighted.  Is this possible?

I did read on a newsgroup thread that the process may be achieved by setting
the variable in the GotFocus event. I haven't actually tried this yet but
wondered if this is the only way to achieve the above.  My database is an
.mde file.

Thanks
Sandy

> They will need to build a query to do that. An Append query, or if the
> columns will change, a Make-Table query are the query types that you will
[quoted text clipped - 12 lines]
>> Thanks in advance
>> Sandy
fredg - 03 Jun 2007 17:11 GMT
> Hi Arvin
> Thanks for the reply. Not sure whether I am misinterpreting your answer or
[quoted text clipped - 35 lines]
>>> Thanks in advance
>>> Sandy

Not by highlighting th entire row.

If all you need is the name of the column, code EACH Field control's
Enter event:

MyVariable = Me.ActiveControl.Name

But first....
Declare MyVariable up in the code window's General Declarations
section so that it is available in all of this form's events.

Option Compare Database
Option Explicit
Dim MyVariable as String

MyVariable will be whatever field the cursor has last been (or
currently is) in.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Arvin Meyer [MVP] - 05 Jun 2007 03:08 GMT
There is no way when selecting a column of data. If the cursor were placed
within a field on any row, you could use the GotFocus event, LostFocus even,
or the Enter or Exit events to write that field's name to a table or a file.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hi Arvin
> Thanks for the reply. Not sure whether I am misinterpreting your answer or
[quoted text clipped - 35 lines]
>>> Thanks in advance
>>> Sandy
 
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.