[AccessD] Extract Field Names to Records

Chris Enright cclenright at yahoo.com
Fri Feb 22 16:11:52 CST 2008


ah ha .... there is a dim light at the end of the tunnel (probably my end.. lol) ... I am starting to see how to do it .. :)
but why do I have to use the WorkSheet, isn't it possible to extract the fields from one of the tables?

Chris


----- Original Message ----
From: Gustav Brock <Gustav at cactus.dk>
To: accessd at databaseadvisors.com
Sent: Friday, February 22, 2008 5:33:55 PM
Subject: Re: [AccessD] Extract Field Names to Records


Hi 
Chris

Oh, 
I 
see 
now 
from 
Mark 
what 
it 
is 
about 
...

But 
again, 
link 
the 
WorkSheet 
and 
open 
a 
recordset.
Now 
field 
names 
are:

  
For 
n 
= 
4 
To 
rst.Fields.Count 
-1
  
  
' 
build 
string 
for 
ListBox
  
  
If 
n 
> 
4 
Then
  
  
  
strFields 
= 
strFields 
& 
";"
  
  
EndIf
  
  
strFields 
= 
strFields 
& 
Chr(34) 
& 
rst.Fields(n).Name 
& 
Chr(34)
  
Next

/gustav

>>> 
Gustav at cactus.dk 
22-02-2008 
17:08 
>>>
Hi 
Chris

Not 
quite 
sure 
if 
I 
understand 
your 
flow, 
but 
why 
not 
just 
link 
(attach) 
the 
WorkSheet 
(or 
Named 
Range) 
in 
Access?
Then 
the 
Excel 
data 
appears 
as 
a 
normal 
table 
and 
you 
can 
easily 
fill 
your 
ListBox.

/gustav

>>> 
cclenright at yahoo.com 
22-02-2008 
16:52 
>>>
Hi,
 
I 
wonder 
if 
someone 
would 
kindly 
help 
me 
do 
this?
We 
record 
employees 
hours 
on 
some 
system 
somewhere 
on 
the 
corporate 
web 
and 
we 
upload 
it 
as 
an 
Excel 
Workbook.
All 
the 
pre-work 
is 
done 
back 
here 
in 
Access 
2003 
and 
exported 
to 
the 
workbook.
The 
problem 
is 
that 
if 
staff 
changes 
are 
made 
with 
the 
present 
system 
it 
requires 
the 
changes 
to 
be 
made 
at 
both 
ends 
and 
I 
am 
trying 
to 
automate 
it 
to 
stop 
errors.
 
For 
example, 
the 
table 
below 
is 
an 
example 
of 
one 
of 
the 
sheets 
imported 
back 
from 
the 
web 
and 
I 
want 
to 
extract 
the 
employee 
names 
that 
are 
currently 
fields 
and 
put 
them 
into 
a 
table 
as 
records 
so 
they 
can 
be 
used 
in 
a 
list 
box. 
(If 
all 
the 
fields 
were 
turned 
to 
records 
I 
would 
just 
delete 
the 
first 
four 
so 
I 
only 
had 
names).
 
Field 
Name  
  
  
  
  
  
  
  
  
Data 
Type
 
RowType  
  
  
  
  
  
  
  
  
  
 
Text
IDWwCoreTask  
  
  
  
  
Text
CoreTaskName  
  
  
  
  
  
Text
Type  
  
  
  
  
  
  
  
  
  
  
  
  
  
Text
Anstey_Simon  
  
  
  
  
  
  
Number
Buckland_David  
  
  
  
  
 
Number
Britton_Pam  
  
  
  
  
  
  
  
 
Number
Chaney_Catharine  
  
  
  
Number
Davis_Steph  
  
  
  
  
  
  
  
 
Number
Etc. 
etc.  
  
  
  
  
  
  
  
  
  
  
  
Number
 
I 
am 
sure 
the 
solution 
is 
somewhere 
in 
the 
archives 
but 
I 
have 
spent 
days 
searching 
them 
and 
Google 
but 
must 
be 
asking 
the 
wrong 
question.
 
Many 
thanks
 
Chris


-- 
AccessD 
mailing 
list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: 
http://www.databaseadvisors.com






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


More information about the AccessD mailing list