insert value in access table based a string
I use the tipical
While Not RS.EOF
rs(0)
rs(1)
move.next
....
wend
and have an acces table with field name CODE1, CODE2, CODE7, CODE9....
During the while not loop the value in rs(0) can assume CODE1, OR CODE2 ....
and rs(1) can assume value 1 or 14
How to insert the related avlue of rs(1) into the table where the filed name is the value of rs(0)...
in thi case the final table is:
CODE1 CODE2
1 14
Re: insert value in access table based a string
Execute sql statement via ado command or connection object:
Code:
Dim strSQL As String
strSQL= "Update MyTable Set Code2 = " & RS.Fields(1).Value & " Where Code1 = " & RS.Fields(0).Value
adoConnection.Execute strSQL
... or something similar to that.
Also, check out ADO Tutorials - there is plenty of useful info.
Re: insert value in access table based a string
Quote:
Originally Posted by
RhinoBull
Execute sql statement via ado command or connection object:
Code:
Dim strSQL As String
strSQL= "Update MyTable Set Code2 = " & RS.Fields(1).Value & " Where Code1 = " & RS.Fields(0).Value
adoConnection.Execute strSQL
... or something similar to that.
Also, check out
ADO Tutorials - there is plenty of useful info.
Yes tk RhinoBull ...
but my into the loop i cannot have a fixed string value, but dinaimic a time a can have CODE1, CODE2, CODE7, CODE9... a time i can have CODE11, CODE32, CODE07...
I think i need an array, or not?
Re: insert value in access table based a string
I don't quite understand what you are trying to say... :confused: Sorry.
Re: insert value in access table based a string
Quote:
Originally Posted by
RhinoBull
I don't quite understand what you are trying to say... :confused: Sorry.
in effect during the loop i can have a seriries of value:
Code2 = " & RS.Fields(1).Value
Code6 = " & RS.Fields(1).Value
Code9 = " & RS.Fields(1).Value
...
Code11 = " & RS.Fields(1).Value
Code18 = " & RS.Fields(1).Value
or
Code35 = " & RS.Fields(1).Value
Code64 = " & RS.Fields(1).Value
Code29 = " & RS.Fields(1).Value
in this case i loop only if Code have a rs.fileds(1) filled from the select query...