Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed getting Rowset(s) from current data source -- Help!!!!

Status
Not open for further replies.

Maximus37

Technical User
Dec 7, 2002
21
0
0
US
Hello guys, I have the following code in VB6sp5, using Access97 db:

If Option2.Value = True Then
With DataEnvironment1
If .rsCommand1.State = adStateOpen Then
.rsCommand1.Close
End If
.Command1 dbcMedium, "01/01/1990", Date
With DataReport3
.DataMember = "Command1"
.Orientation = rptOrientLandscape
.Title = "Referencias Registradas para " & dbcMedium.Text
.Caption = "Reporte General para " & dbcMedium.Text
.Show
End With
End With
End If
If Option3.Value = True Then
With DataEnvironment1
If .rsCommand1.State = adStateOpen Then
.rsCommand1.Close
End If
.Command1 dbcMedium.Text, DTPicker1.Value, DTPicker2.Value
With DataReport3
.DataMember = "Command1"
.Orientation = rptOrientLandscape
.Caption = "Reporte de Referencias"
.Title = "Referencias Registradas para " & dbcMedium.Text & " del " & DTPicker1.Value & " al " & DTPicker2.Value
.Show
End With
End With
End If
If Option4.Value = True Then
DTPicker1.Value = "01/01/1990"
DTPicker2.Value = Date
With DataEnvironment1
If .rsCommand2.State = adStateOpen Then
.rsCommand2.Close
End If
.Command2 dbcMedium, DTPicker1, DTPicker2
With DataReport3
'Set .DataSource = DataEnvironment1
.DataMember = "rsCommand2"
.Orientation = rptOrientLandscape
.Caption = "Reporte de Referencias"
.Title = "Referencias Registradas para " & dbcMedium
.Show
End With
.rsCommand2.Close
End With
End If
If Option5.Value = True Then
With DataEnvironment1
If .rsCommand2.State = adStateOpen Then
.rsCommand2.Close
End If
.Command2 dbcMedium.Text, DTPicker1.Value, DTPicker2.Value
With DataReport3
Set .DataSource = DataEnvironment1
.DataMember = "Command2"
.Orientation = rptOrientLandscape
.Caption = "Reporte de Referencias"
.Title = "Referencias Regeistradas para " & dbcMedium.Text & " del " & DTPicker1.Value & " al " & DTPicker2.Value
.Show
End With
.rsCommand2.Close
End With
End If

This a command button that should display a datareport.

The first two options work just fine, but as soon as I try to display the datareport of option4, this error displays

"Failed getting Rowset(s) from the current data source"

I'm using the same database and table; the same SQL for both DataEnvironment1.Command# (Command1, Command2) except that in Command2, the SQL just changes a field, for instance, instead of Consignee it tries to retrieve Shipper, but the rest is set the same as Command1 and its properties for the parameters and data, etc. yet Command1 works but not Command2.

If I debug step by step, it shows that when it is supposed to execute Command2, it does Command1.

I such case, it displays a Type Mistmatch error, but the properties in the db and fields are all correct.

What am I doing wrong ?

Thank you a lot for your expert and valuable advice.

Max35.
 
By the look of it, in Option 4 this line:
Code:
              .DataMember = "rsCommand2"
should be
Code:
              .DataMember = "Command2"
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top