blackjack020900
asked on
Assignment of a value to a Record Set Object with ADO?
Why do we get a Runtime Error (-2147467259(80004005))? The Statement is done but the MoveNext-Methode cuts off.
With rs
.ActiveConnection = frmMain.m_dbConn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = sSQLAbr
.Open
End With
While Not rs.EOF
rs!VersandartenText = "hallo"
rsmerk.MoveNext
Wend
With rs
.ActiveConnection = frmMain.m_dbConn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = sSQLAbr
.Open
End With
While Not rs.EOF
rs!VersandartenText = "hallo"
rsmerk.MoveNext
Wend
I'd also advice to use rs.Update so you make sure the datachanges will be committed, like
rs!VersandartenText = "hallo"
rs.Update
rs.MoveNext
cheerio
rs!VersandartenText = "hallo"
rs.Update
rs.MoveNext
cheerio
ASKER
I don't want to make an update, because the field doesn't exist in the database it's only located in a Record Set.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The field was selected with the following statement:
sSQLAbr =
" select versandart," &_
" VersandartenText= 'xxxxxxxxxxxxx'" &_
" from auftrag"
....
This means, the field does not exist in the DB but is only generated in the SELECT statement
sSQLAbr =
" select versandart," &_
" VersandartenText= 'xxxxxxxxxxxxx'" &_
" from auftrag"
....
This means, the field does not exist in the DB but is only generated in the SELECT statement
Then it should crash in the assign statement rs!vers...="Hallo", and not in the movenext!! You don't have a field called VersandartenText because:
- it doesn't exist in the db
- you didn't add it as an alias in the select statement
- it doesn't exist in the db
- you didn't add it as an alias in the select statement
ASKER
Thanks!
It just took a while till I figured it out!
It just took a while till I figured it out!
While Not rs.EOF
rs!VersandartenText = "hallo"
rs.MoveNext
Wend