ADD new fields from a loop
I just have a table1 into c:\mydir\mymbd.mdb
I just have 3 fields (field1, field2..)
I need, from the loop in code, to add new fields based the var TEST
Code:
RIGA = 0
While Not GAF_RS.EOF
TEST = GAF_RS(0)
RIGA = RIGA + 1
GAF_RS.MoveNext
Wend
note:
all fields are TEXT format and max character from var TEST is max 2
please with vb6 code, tks.
possible?
Re: ADD new fields from a loop
Modify to fit your needs
Code:
Dim sSQL As String
RIGA = 0
While Not GAF_RS.EOF
TEST = GAF_RS(0)
sSQL = "ALTER TABLE table1 ADD " & Test & " Text(2) "
YourConnectionObject.Execute sSQL
RIGA = RIGA + 1
GAF_RS.MoveNext
Wend
Re: ADD new fields from a loop
Quote:
Originally Posted by
hack
modify to fit your needs
Code:
dim ssql as string
riga = 0
while not gaf_rs.eof
test = gaf_rs(0)
ssql = "alter table table1 add " & test & " text(2) "
yourconnectionobject.execute ssql
riga = riga + 1
gaf_rs.movenext
wend
excelletnt!