This is very close to what I am looking for - to use the SourceObject or
similar attribute to point to a different table on demand.
I tried what you propsed and failed. Here is what I did, please tell me
what am I going wrong:
(1) Referenced in MS DAO 3.6 Object library.
(2) Added a subform on my main form pointing to any dummy table.
(3) In VBA, I added the following code:
'----------- Begin Code --------------------
Dim db as DAO.Database
Set db = Currentdb
Me.subform.Sour ceObject = db.TableDefs("T able1").Name
Me.subform.Sour ceObject = db.TableDefs("T able2").Name
'----------- End Code ----------------------
Let me restate what I am trying to do in case others are reading this
post for the first time:
(1) I am developing a program in MS Access that allows users to import
addresses from text or any other files, process those addresses in the
local MDB file, then export them those addresses after processing them.
It does not matter what the processing is, because it seems to take
responders off a tangent. But if it helps, the processing is geocoding,
where I read it an address, and I generate a longitude/latitude for each
address in new/existing columns. Note that the column names imported
are not required to have exact column names and hence their is some
column mapping involved in the program. The processing needs to
find/map at least 4 columns for input: Address, City, State, and Zip
Code. And it writes to 2 new/existing columns called Longitude and
Latitude and other columns if needed.
(2) I need the user to visually see the table they just imported into
the local MDB file in DataSheet view IN A SMALL SUBFORM OR WINDOW ON THE
SAME FORM. Note the capital letters for emphasis. The reason for that
is that I need users to traverse their table one record at a time and
make changes as needed while SEEING the rest of the main form. The data
has to be bound to the rest of the form.
(3) My problem is as follows:
(a) I tried using subforms, but they have a fundamental flaw in
assuming that I know the table's columns apriori, i.e., I cannot assign
a subform to just any table the user can import. I would love to have
something like the RowSource attribute for listboxes that I can assign
programmaticall y.
(b) I tried using all kinds of grid objects like MSFlexGrid,
MSHFlexGrid, DataGrid, DBGrid and all of them have one or more
limitations that don't work for me. If you bind them to the data they
become extremely slow. And if unbound, you have to work out the
logistics of writing back the user edits to the underlying tables.
Also, I had a very hard time binding those grid objects to the
underlying tables in the same local MDB file using the ADODC control.
So, my question is very simple:
How do I get subforms or similar functionality to display ANY local
table imported by my users in DataSheet view IRRESPECTIVE OF THEIR TABLE
STRUCTURE OR COLUMN NAMES ?
Regards,
Aladdin Nassar
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!