Hi,
I am having problems with my code in MS Access. I receive an error that says "arguments are of the wrong type, are out of acceptance range, or are in conflict with one another".
Here's the code. It errors on the last line shown here:
Dim stDocName As String
Dim cnn As New ADODB.Connection
Dim cmd1 As New ADODB.Command
Dim Adors As ADODB.Recordset
Dim sqltext As String
Dim db As Database
Dim recSet As Recordset
Dim Patient_DOB As Date
Dim CurDate As Date
Set db = CurrentDb()
Set recSet = db.OpenRecordset("tbl_BehaviorHealth")
sqltext = txtEventNumber
If sqltext <> "" Then
' Open a connection using an ODBC DSN.
cnn.ConnectionString = "Provider=SQLOLEDB; Data Source=bjcsql04; Initial Catalog=RiskMaster;User Id=rmsysadm; Password=riskm1"
cnn.Open
cmd1.ActiveConnection = cnn
cmd1.CommandType = adCmdStoredProc
cmd1.CommandText = "BehaviorHealthRpt"
cmd1.Parameters(1) = sqltext
cmd1.CommandTimeout = 90
Set Adors = New ADODB.Recordset
Adors.Open cmd1.Execute, cnn, adOpenDynamic, adLockOptimistic
What's wrong?
Tina
I am having problems with my code in MS Access. I receive an error that says "arguments are of the wrong type, are out of acceptance range, or are in conflict with one another".
Here's the code. It errors on the last line shown here:
Dim stDocName As String
Dim cnn As New ADODB.Connection
Dim cmd1 As New ADODB.Command
Dim Adors As ADODB.Recordset
Dim sqltext As String
Dim db As Database
Dim recSet As Recordset
Dim Patient_DOB As Date
Dim CurDate As Date
Set db = CurrentDb()
Set recSet = db.OpenRecordset("tbl_BehaviorHealth")
sqltext = txtEventNumber
If sqltext <> "" Then
' Open a connection using an ODBC DSN.
cnn.ConnectionString = "Provider=SQLOLEDB; Data Source=bjcsql04; Initial Catalog=RiskMaster;User Id=rmsysadm; Password=riskm1"
cnn.Open
cmd1.ActiveConnection = cnn
cmd1.CommandType = adCmdStoredProc
cmd1.CommandText = "BehaviorHealthRpt"
cmd1.Parameters(1) = sqltext
cmd1.CommandTimeout = 90
Set Adors = New ADODB.Recordset
Adors.Open cmd1.Execute, cnn, adOpenDynamic, adLockOptimistic
What's wrong?
Tina