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

New Topic/Question
Reply




MultiQuote




|