I select a month from a combobox and type the year in maskeditbox then press a button to show the report. 1st the report show. when I select another month to show again the report then show a error msg:

run-time error 3705
operation is not allowed when the object is open

and then highlight the connection string.

Recommended Answers

All 3 Replies

First close your recordset. Re-open the recordset with the new date criteria and then refresh the grid.

RS.close
RS.Open "......................."

Grd.Refresh

Hope this helps Abu

I write code in the button

Private Sub cmdshow_Click()
     Dim str As String
    str = "01/" & cmbMonth.ListIndex + 1 & "/" & MaskEdBox1.Text
    dt = Format(str, "DD/MM/YYYY")
   
    If isLoad = True Then
        Unload dr1
        Unload DataEnvironment1
    Else
        isLoad = True
    End If
    
    
    DataEnvironment1.cmdmonth (dt)
    Unload Me
    Load dr1
   dr1.Show

in dataenvironment>command> I write code

Select * from main
Where Month(Date)=Month(dt)
And Year(Date)=Year(dt)
Order by Date Asc

and the I connect the database in dataenvironment manually.

I just change it and now it is ok.

If isLoad = false Then        Unload dr1        Unload DataEnvironment1    Else        isLoad = True    End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.