|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Loop through fields
I have two tables I need to combine and move into one main table. But each time I need to run a 'tidy' program on each field.
I might also need to change the fields on occasion. I therefor wanted to add a loop in and change in to the field name for a .edit where the orderID (the only thing linking the two tables) was present. I have tried .fields(1) then looping to make 1 to 2 etc.. e.g. .fields(vLoop) with vLoop = vLoop + 1 each time. However the fields in the tables are not aligned so this would not work. I've tried selecting out each field name from a seperate database; strSQLRSCSVField = "SELECT * FROM Tb_Move Where CSVField = 1 ORDER BY ID Desc;" then looping throught but the variable does not seem to work, as I can get it to do in ASP3 (doing in VB6 as most of cvoce can be recycled from an earlier project) So I would put the next line of code in a loop and change the name each time, ok it means opening and closing the loop alot but for now it's simpler and alot less code!! .Fields(vName) = vSelected to work? |
|
#2
|
||||
|
||||
|
I don't think there is an emoticon for "blank stare" but that's what I find myself doing after reading this post like four times. (Huh?)
I'd like to help but I'm not even certain you asked a question ... so with that said, if you DO need help, wanna try to explain the problem again a ... different way? I got that you have two tables. You need to combine them. And you want to run a tidy routine on them. Than I lose you. I know it makes perfect sense to you but we don't know what you mean by at least half of that because we can't see inside your head Try explaining the problem verbally as though you are talking to someone who doesn't know about programming or loops ... |
|
#3
|
|||
|
|||
|
[QUOTE=Leslie]
I got that you have two tables. You need to combine them. And you want to run a tidy routine on them. [QUOTE] I did but doing it a simpler way. When I am merging my data a tempory table is created with all the orderID references in. This is then reference for which items need to be tidied. Rather than hundreds of lines of code it goes to a table called tb_tidy and it has a column with all the field names in. It then loops though editing them, ok it opens and closes the database alot this way but it works right. Keeps it short and sweat. Only 1000 records a day. |
|
#4
|
|||||
|
|||||
|
you can use arrays.
build two arrays - each will contain the fields of one of the tables, then you can use loop. crude sample: VB Code:
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Loop through fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|