Operation is not allowed when object is open
hai,
I have a problem with my vb code,displaying run time error 3705,"Operation is not allowed when object is open".How to solve this problem.i am using MS access as backend.
Private Sub Command1_Click()
DE1.combine (txtLabNo.Text)
DataReport2.Show
End Sub
error is displayed in line 2.
actually the project is developed for a lab.I want to generate a data report based on the parameter.For this i add a new comand to the connection property of data environment.and in the command properties,on the sql builder section i add the following
SELECT T1.*, T2.* FROM patient_entry T1, combine_result T2 WHERE T1.trc_lab_no = ?
this is to combine the records of two tables and make them as one single data report.
so please advise....
Re: Operation is not allowed when object is open
Check for your connection. Are you trying to re-open the connection?
Re: Operation is not allowed when object is open
hi, post your code so we can have a look
Re: Operation is not allowed when object is open
You are trying to connect with 2 object at the same time without closing connection with previous one.
DE1.combine (txtLabNo.Text) 'txtLabNo
DataReport2.Show 'Datareport
Try to connect one object at the same time.
Re: Operation is not allowed when object is open
you need to close the connection to the dataenvironment like
DataEnvironment1.rsCommand1.Close
you may use another button to effect this line of code
Re: Operation is not allowed when object is open
you need to check if it is open after manipulating data . you need to close the rscommand1 .try the following way .
Code:
DE1.combine (txtLabNo.Text) 'txtLabNo
DataReport2.Show 'Datareport
if DataEnvironment1.rsCommand1.open then 'after showing records you need to close .
DataEnvironment1.rsCommand1.Close
End if