Click to See Complete Forum and Search --> : bookmarks


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

Ghost308
June 26th, 2001, 11:10 AM
Maybe I'm analyzing the wrong problem, but in your second SQL line you put the single quote for commentation before the double quote to end the string. Is it that way in your actual code or just a typo in your post?

Catrina
June 26th, 2001, 11:31 AM
When using Access, string data must be surrounded by 's (ex:"'" & text.text & "'") in the SQL statement. The way this board displays it makes it look incorrect. I'm fine with opening the recordset, it is the update I'm having trouble with.

Catrina

richardj
June 27th, 2001, 07:33 AM
Is your array DBook() a variant array? There's no 'Dim' for it in your post, and because you're setting its size there and then without using ReDim I guess that DBook isn't being declared earlier on.

Do you still get the error if you explicitly declare DBook as a variant array, then use ReDim when you know the size of it?

eg

Dim DBook()
.....
ReDim DBook(a&)
...

Catrina
June 27th, 2001, 08:31 AM
I have it defined as a Public Variant in a module. The size will always be 10, so I do not redim. When I step through, it contains the bookmark, but I still get the error.

I have solved the problem by closing the original recordset, then opening a recordset according to the box they are currently in to make the update record by record. May be a wasteful way of doing it, but it works and I needed a fix fast.

Thanks for your reply

Catrina