|
-
Apr 9th, 2013, 12:48 PM
#2
Member
Re: How to use vb6 recordset loop in crystal reports?
The short answer to your question whether you can do this without the intermediary temp table is Yes, you can :-)
I have some remarks about your code. I hope you are not bothered by them.
The procedure that you present uses various variables, including snoval, brnoval, stdnameval, amtbpaidval, totpaidval and balval. Where are these declared? What is their type? For example, balval. At one point you use it as a numerical type:
balval = amtbpaidval - totpaidval
Then a few lines down you use it as a string:
balval = Format(balval, "###,###,###")
This is not good because it can lend itself to confusion, both for the developer and the VB6 environment.
If these variables are used only inside this procedure then they should be declared within it. If they are used in various procedures then you need to design the app in a way that they won't.
For example, going back to balval. You could define it as Currency then in the insert do something like this:
cn.Execute "insert into balrep values ('" & snoval & "','" & brnoval & "','" & stdnameval & "'," _
& "'" & amtbpaidval & "','" & totpaidval & "','" & Format(balval, "###,###,###") & "')"
Now, to answer your question. You can open the original record set, disconnect it, set values in the loop (snoval) then finally pass the record set to the report. Also, leave the amounts as numerical (do not format using the ###,###,### format) in the VB6 code and then do the formatting in the report.
I have a question: Is the BalRep table the only table that is used in the report?
Regards, SGarv
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|