Catrina
June 26th, 2001, 11:06 AM
I am having trouble with Bookmarks, this is the first time I have attempted to use them. I have a table that holds multiple entries for each employee. I open the recordset that fill text boxes with the data all on one screen. If an item needs changed, I am having a problem, I get the error "Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another". Perhaps I am going about this the wrong way. Basicly what I need is a way to display multiple records and update the records if the user makes a change.Any advice would be appreciated. Thanks in advance.
Catrina
Here is my code:
''Opening the recordset with all records for the needed employee
set rsDirect = new ADODB.Recordset
SQL$ = ""
SQL$ = "SELECT * FROM DirectDeposit WHERE PAYEMP='"
SQL$ = SQL$ & text(0).text & "' Order By Tran asc"
rsDirect.Open SQL$, Access, adOpenKeyset, adLockOptimistic
''''filling the textboxes with the data
TranNo$ = ""
If Not rsDirect.EOF then
rsDirect.MoveFirst
for a% = 1 to rsDirect.RecordCount
If rsDirect!Tran <> "N" then
'''setting the variable holding the bookmark
DDBook(a%) = rsDirect.Bookmark
BX% = Val(rsDirect!Tran) ''Tran tells which line the data is going to
txtDed(BX%).text = rsDirect!Ded
txtTran(BX%).text = rsDirect!Code
txtAccount(BX%).text = rsDirect!Account
txtRoute(BX%).text = rsDirect!Route
else
DDBook(a%) = rsDirect.Bookmark
txtTran(0).text = rsDirect!Code
txtAccount(0).text = rsDirect!Account
txtRoute(0).text = rsDirect!Route
End If
rsDirect.MoveNext
next a%
End If
''trying to change the data
stAcc$ = mid(lblAcc(Index).Caption, 2) & Left(ZOUT$ & Space(17), 17)
rsDirect.Bookmark = DDBook(Index) ''I get the error here
rsDirect!Account = mid(stAcc$, 4)
rsDirect.Update
Catrina
Here is my code:
''Opening the recordset with all records for the needed employee
set rsDirect = new ADODB.Recordset
SQL$ = ""
SQL$ = "SELECT * FROM DirectDeposit WHERE PAYEMP='"
SQL$ = SQL$ & text(0).text & "' Order By Tran asc"
rsDirect.Open SQL$, Access, adOpenKeyset, adLockOptimistic
''''filling the textboxes with the data
TranNo$ = ""
If Not rsDirect.EOF then
rsDirect.MoveFirst
for a% = 1 to rsDirect.RecordCount
If rsDirect!Tran <> "N" then
'''setting the variable holding the bookmark
DDBook(a%) = rsDirect.Bookmark
BX% = Val(rsDirect!Tran) ''Tran tells which line the data is going to
txtDed(BX%).text = rsDirect!Ded
txtTran(BX%).text = rsDirect!Code
txtAccount(BX%).text = rsDirect!Account
txtRoute(BX%).text = rsDirect!Route
else
DDBook(a%) = rsDirect.Bookmark
txtTran(0).text = rsDirect!Code
txtAccount(0).text = rsDirect!Account
txtRoute(0).text = rsDirect!Route
End If
rsDirect.MoveNext
next a%
End If
''trying to change the data
stAcc$ = mid(lblAcc(Index).Caption, 2) & Left(ZOUT$ & Space(17), 17)
rsDirect.Bookmark = DDBook(Index) ''I get the error here
rsDirect!Account = mid(stAcc$, 4)
rsDirect.Update