Strange Problem with Report

ashutosh9910
12-13-2003, 05:20 AM
Hi all

I have a strange problem.


On the Click event of a command button, I am trying to show a Data Report. The Code goes like this:

Private Sub Command1_Click()

dim qaddress as string

qaddress = form1.combo1.text

call vibreport 'Vibreport is the function in the module
envreport.cmdvib qaddress 'Envreport is the Data 'Environment, cmdvib is command
data report1.show

end sub


The Function vibreport is as below:

Public function vibreport()


query = "Select * [from Table A] where ID = '" & form1.combo1.text & "'"
set rs = con.execute(query) ' Con is the connection

query1 = "Select * [from Table B] where ID = '" & form1.combo1.text & "'"
set rs1 = con.execute(query1) ' Con is the connection



set rs2 = new adodb.recordset

rs2.open "[Table C]", con, adOpenKeyset, adLockOptimistic

While not rs1.eof

rs2.addnew
rs2.fields(0) = form1.combo1.text
rs2.fields(1) = rs1.fields(0)
rs2.fields(2) = rs1.fields(1)
rs2.fields(3) = rs.fields(0)
rs2.fields(4) = rs.fields(1)
rs2.fields(5) = rs.fields(2)
rs2.update

rs1.movenext
wend
rs2.close

set rs2 = nothing

End Function


Now the problem is that I have two records in my rs1 recordset.

Case 1 : When I run my program normally

In the Data Report, only one record is shown

Case 2: When I insert a breakpoint at the statement "While not rs1.eof"

In data report, I have two records one after the another.



In cmdvib, the source of Data is an SQL query "Select * from [Table C] where ID = ?"

Could Someone help me get both my recoeds to the data report without having the breakpoint?

Thanks in advance.

Shurik12
12-13-2003, 04:53 PM
Hi,
>Case 2: When I insert a breakpoint at the statement "While not rs1.eof"
In data report, I have two records one after the another.

Try to put DoEvents instead and see if it works.

Just to point out (altough this must be a 'typo'?):

"Select * [from Table A] Where..."
"Select * [from Table B] Where..."

probably it should look like
"Select * from [Table A] where ID ....
....

Regards,
Shurik.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum