HiVb'ers:
I am receiving Error Msg:
Run Time Error ‘3001’
Arguments are the wrong type, are out of acceptable range, or are in conflict with one another.
When I looked it up (in MS Knowledge Base) this is what I read. But because I am new to VB 6 I don’t know which one applies or how to fix it. I placed the code at the bottom.
SYMPTOMS
Setting a Recordset's ActiveConnection property to a recordset object causes either a Dr. Watson or a general protection fault (GPF) error to occur. For example:
Set rst.ActiveConnection = rst
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
This problem has been fixed in MDAC version 2.1 Service Pack 2.
Under MDAC versions 2.1 Service Pack 2 and later, you will receive the following trappable error as expected:
Run-time error '3001': Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
MORE INFORMATION
It is not recommended to set the ActiveConnection property to a recordset object. It is recommended that the Recordset's ActiveConnection property be set to an actual Connection object or connection string. The proper behavior is for Visual Basic to respond with a trappable error because ActiveX Data Objects (ADO) is expecting a connection string or object.
Since I don't know what the heck I'm doing this also seems plusible:
SYMPTOMS
When you try to specify a connection string to use the persist provider to open from a valid ADO stream object, you receive the following error message:
Run-time error '3001': Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
CAUSE
When a stream is used to open a recordset, there should be no parameters specified other than the source parameter of the open method.
RESOLUTION
Remove any parameter other than the source of the recordset as follows:
rs.Open stm ' no other parameters should be specified
Thanks again
Trudye
Public Function Open_the_DataBase()
On Error GoTo dbErrors
'-Create a new connection
Set adoConnection = New ADODB.Connection
'Create a new Recordset
Set adoRS1 = New ADODB.Recordset
Set adoRS2 = New ADODB.Recordset
Set adoRS3 = New ADODB.Recordset
'-Build our connection string to use when we open the connection
adoConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\VB Practice\zGDS_Data_V6_1_2k.mdb;" _
& "Mode=ReadWrite|Share Deny None;Persist Security Info=False"
adoConnection.Open
'Test DB Open
If adoConnection.State = adStateOpen Then
Else
MsgBox "Connection for zGDS_Data_V6_1_2k.mdb Failed " & connectString
End If
'Open individual Tables via Recordset keyword
adoRS1.Open "select * from Family_Eligibility", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
adoRS2.Open "select * from IncomeA", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
adoRS3.Open "select * from Tracking", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
Open_the_DataBase = True
gCurrentState = Now_Loading
Exit Function
dbErrors:
Open_the_DataBase = False
MsgBox (Err.Description)
End Function
NOW HERE COMES THE REAL QUESTIONABLE CODE
Public Sub LoadTab0()
Dim H_ID As Integer
Dim adorsFEE As ADODB.Recordset
Dim sqlFee As String 'Family_Elig - Fee - Tab0
Call ClearTab0
If gCurrentState = Now_Loading Then
adoRS1.MoveFirst
End If
‘gScccc_ID is a global variable
sqlFee = "SELECT * FROM adoRS1"
sqlFee = sqlFee & " Where adors1!scccc_id = “ & gScccc_ID
Set adorsFEE = adoConnection.OpenRecordset(sqlFee)
H_ID = adorsFee!scccc_id
txtFamily_size = adorsFee!family_size
txtTot_Fam_Income = adorsFee!tot_fam_Income
txtFull_Rate = adorsFee!full_rate
txtPart_rate = adorsFee!part_rate
txtPrivate_Fee = adorsFee!Private_fee
cboRate_Type = adorsFee!rate_type
End Sub
Thanks much
Trudye
I am receiving Error Msg:
Run Time Error ‘3001’
Arguments are the wrong type, are out of acceptable range, or are in conflict with one another.
When I looked it up (in MS Knowledge Base) this is what I read. But because I am new to VB 6 I don’t know which one applies or how to fix it. I placed the code at the bottom.
SYMPTOMS
Setting a Recordset's ActiveConnection property to a recordset object causes either a Dr. Watson or a general protection fault (GPF) error to occur. For example:
Set rst.ActiveConnection = rst
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
This problem has been fixed in MDAC version 2.1 Service Pack 2.
Under MDAC versions 2.1 Service Pack 2 and later, you will receive the following trappable error as expected:
Run-time error '3001': Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
MORE INFORMATION
It is not recommended to set the ActiveConnection property to a recordset object. It is recommended that the Recordset's ActiveConnection property be set to an actual Connection object or connection string. The proper behavior is for Visual Basic to respond with a trappable error because ActiveX Data Objects (ADO) is expecting a connection string or object.
Since I don't know what the heck I'm doing this also seems plusible:
SYMPTOMS
When you try to specify a connection string to use the persist provider to open from a valid ADO stream object, you receive the following error message:
Run-time error '3001': Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
CAUSE
When a stream is used to open a recordset, there should be no parameters specified other than the source parameter of the open method.
RESOLUTION
Remove any parameter other than the source of the recordset as follows:
rs.Open stm ' no other parameters should be specified
Thanks again
Trudye
Public Function Open_the_DataBase()
On Error GoTo dbErrors
'-Create a new connection
Set adoConnection = New ADODB.Connection
'Create a new Recordset
Set adoRS1 = New ADODB.Recordset
Set adoRS2 = New ADODB.Recordset
Set adoRS3 = New ADODB.Recordset
'-Build our connection string to use when we open the connection
adoConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\VB Practice\zGDS_Data_V6_1_2k.mdb;" _
& "Mode=ReadWrite|Share Deny None;Persist Security Info=False"
adoConnection.Open
'Test DB Open
If adoConnection.State = adStateOpen Then
Else
MsgBox "Connection for zGDS_Data_V6_1_2k.mdb Failed " & connectString
End If
'Open individual Tables via Recordset keyword
adoRS1.Open "select * from Family_Eligibility", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
adoRS2.Open "select * from IncomeA", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
adoRS3.Open "select * from Tracking", _
adoConnection, adOpenDynamic, adLockOptimistic, adCmdText
Open_the_DataBase = True
gCurrentState = Now_Loading
Exit Function
dbErrors:
Open_the_DataBase = False
MsgBox (Err.Description)
End Function
NOW HERE COMES THE REAL QUESTIONABLE CODE
Public Sub LoadTab0()
Dim H_ID As Integer
Dim adorsFEE As ADODB.Recordset
Dim sqlFee As String 'Family_Elig - Fee - Tab0
Call ClearTab0
If gCurrentState = Now_Loading Then
adoRS1.MoveFirst
End If
‘gScccc_ID is a global variable
sqlFee = "SELECT * FROM adoRS1"
sqlFee = sqlFee & " Where adors1!scccc_id = “ & gScccc_ID
Set adorsFEE = adoConnection.OpenRecordset(sqlFee)
H_ID = adorsFee!scccc_id
txtFamily_size = adorsFee!family_size
txtTot_Fam_Income = adorsFee!tot_fam_Income
txtFull_Rate = adorsFee!full_rate
txtPart_rate = adorsFee!part_rate
txtPrivate_Fee = adorsFee!Private_fee
cboRate_Type = adorsFee!rate_type
End Sub
Thanks much
Trudye