Update Table.fields data in a loop

mveijndh

Registered User.
Local time
Today, 06:30
Joined
Dec 17, 2011
Messages
113
I'm trying to update a table with a for next loop.
I've found I can read datga from the table, but can't write data to it.

With rst1
.AddNew
For x = 1 To Teller1 - 1
If x = DateNo Then
!Fields(x).Value = Now()
elsif
Else
!Fields(x).Value = dblCurrency(x)
End If
Next x
.Update
End With

I get the error 3265, no such element in collection. I use the same code to get the field names that works fine:

fielddescription(x) = rst1.Fields(x).Name

where am I missing the ball???
 
Here's your code properly indented. See anything wrong?
Code:
   With rst1
      .AddNew
      For x = 1 To Teller1 - 1
         If x = DateNo Then
            !Fields(x).Value = Now()
            elsif
         Else
            !Fields(x).Value = dblCurrency(x)
         End If
      Next x
      .Update
   End With
 
No, Think it's correct, copiedit in and forgot to change the layout. Thanks
 
What's with the extra elsif [sic] and spelled funny.
Code:
         If x = DateNo Then
            !Fields(x).Value = Now()
            [B][I]elsif[/I][/B]
         Else
 
Sorry, the elseif is not relevant for now, just in the future. Testing the principle now aren't we?
 
Does it work without the misspelled elsif? Why are you using a bang "!" instead of a dot "."?
 
And that my friend were the magic words! I'd completly overlooked the !
Thanks very much
 

Users who are viewing this thread

Back
Top Bottom