run time error generate in visual basic with sql server 2000

run time error 3001 "argument are of wrong type, are out of accep

Page 1 of 1

1 Replies - 5936 Views - Last Post: 06 June 2007 - 10:35 AM Rate Topic: -----

#1 vbhem4u  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-June 07

run time error generate in visual basic with sql server 2000

Posted 01 June 2007 - 03:40 AM

In this following code we want to pick value form combobox month and year and count the total number of jobseeker registered and that value show on the textbox.
When i run that code it show the run time error'3001'
So Plz solve that problem

Thanx in advance

The code is following
Private Sub cmdShow_Click()
 
 Dim adoconn As New ADODB.Connection
 Dim adoCD As New ADODB.Command

Dim strSQL As String
 
	Dim m1, m2, y1, y2, FY1, FY2
	Dim Desc As String, AllOK As Boolean
	AllOK = True
	If cboMonth.Text = "" Then AllOK = False
	If cboYear.Text = "" Then AllOK = False
	If cboMonth1.Text = "" Then AllOK = False
	If cboYear1.Text = "" Then AllOK = False
	If Not (AllOK) Then
  MsgBox "All combo boxes require an entry.", vbOKOnly + vbInformation, "Information Missing"
  'cboMonth.SetFocus
 
  If cboYear1.Text = "" Then cboYear1.SetFocus
  If cboMonth1.Text = "" Then cboMonth1.SetFocus
  If cboYear.Text = "" Then cboYear.SetFocus
  If cboMonth.Text = "" Then cboMonth.SetFocus
	'  Exit Sub
 End If
	
	m1 = Trim(cboMonth.Text)
	y1 = Trim(cboYear.Text)
	m2 = Trim(cboMonth1.Text)
	y2 = Trim(cboYear1.Text)
	
	FY1 = y1 + "-" + m1 + "-1"
	FY2 = y2 + "-" + m2 + "-31"
   
	If FY1 > FY2 Then
	MsgBox "Starting Search Date not be greater then the Ending Search Date.", vbOKOnly + vbInformation, "Date Selection is Wrong"
	cboYear.SetFocus
	Else
  txtRegisDetails.Text = FY1 & " to " & FY2
	End If

adoconn.ConnectionString = "driver={SQL Server};server=LocalDB;uid=text;database=dbjobs"

adoconn.Open
adoCD.ActiveConnection = Connection

Dim adoRS As New ADODB.Recordset
adoCD.CommandText = "SELECT count(registerdate) FROM cutomer where registerdate between " + FY1 + "and" + FY2
Set adoRS = adoCD.Execute

Dim myValue As String
If adoRS.BOF = True And adoRS.EOF = True Then
  myValue = adoRS.Fields(0)
End If
End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: run time error generate in visual basic with sql server 2000

#2 KeyWiz  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 438
  • Joined: 26-October 06

Re: run time error generate in visual basic with sql server 2000

Posted 06 June 2007 - 10:35 AM

try this for your retrieve command

adoCD.CommandText = "SELECT count(registerdate) FROM cutomer WHERE customer.registerdate BETWEEN " + FY1 + " AND " + FY2

This post has been edited by KeyWiz: 06 June 2007 - 10:36 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1