Bebe
Apr 19th, 2000, 04:37 AM
I can't get this code to query the database with the results from this code i get select from Master where Date_Opened between #01/12/99 and #xx/xx/xx; numbers dependent on what you select in cbo box
Please help!!!
Private Sub Command1_Click()
Dim strStartDate As String
Dim strStartDateMonth As String
Dim strEndDate As String
Dim sql As String
Dim A As String
If cboMonth = "January" Then
cboMonth = "1"
If cboMonth = "February" Then
cboMonth = "2"
If cboMonth = "March" Then
cboMonth = "3"
If cboMonth = "April" Then
cboMonth = "4"
If cboMonth = "May" Then
cboMonth = "5"
If cboMonth = "June" Then
cboMonth = "6"
If cboMonth = "July" Then
cboMonth = "7"
If cboMonth = "August" Then
cboMonth = "8"
If cboMonth = "September" Then
cboMonth = "9"
If cboMonth = "October" Then
cboMonth = "10"
If cboMonth = "November" Then
cboMonth = "11"
If cboMonth = "December" Then
cboMonth = "12"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
A = Mid(cboYear.Text, 3, 2) 'get 94 from 1994
strStartDate = Format("10/4/94", "dd/mm/yy")
strEndDate = Format("01 " & cboMonth & " " & cboYear, "dd/mm/yy")
If CDate(strStartDate) < CDate(strEndDate) Then
' txtDate.Text = "Select * " & "From Master " & "WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate
'Data1.RecordSource = "select from Master where DATE_OPENED '" & strStartDate & "' and '" & strEndDate
'Data1.RecordSource = txtDate.Text
' Data1.RecordSource = "SELECT (*) from MASTER WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate
'txtDate.Text = sql
'Data1.RecordSource = sql
'Data1.Recordset.MoveFirst
'Else
' txtDate.Text = "Records do not go back to: " & strEndDate
'End If
'If Data1.Recordset.NoMatch Then
'MsgBox "No such Auto Response Number in the PSR Database", vbOKOnly, "PSR Record Not Found"
Data1.Refresh
Data1.RecordSource = "SELECT from Master where DATE_OPENED between '" & "#" & strStartDate & "#" & "' and '" & "#" & strEndDate & "#"
Data1.Recordset.MoveNext
' If Data1.Recordset.NoMatch Then
' MsgBox "No such Auto Response Number in the PSR Database", vbOKOnly, "PSR Record Not Found"
Form2.MSFlexGrid1 = Data1.RecordSource
'Form3.Show
End If
End Sub
Please help!!!
Private Sub Command1_Click()
Dim strStartDate As String
Dim strStartDateMonth As String
Dim strEndDate As String
Dim sql As String
Dim A As String
If cboMonth = "January" Then
cboMonth = "1"
If cboMonth = "February" Then
cboMonth = "2"
If cboMonth = "March" Then
cboMonth = "3"
If cboMonth = "April" Then
cboMonth = "4"
If cboMonth = "May" Then
cboMonth = "5"
If cboMonth = "June" Then
cboMonth = "6"
If cboMonth = "July" Then
cboMonth = "7"
If cboMonth = "August" Then
cboMonth = "8"
If cboMonth = "September" Then
cboMonth = "9"
If cboMonth = "October" Then
cboMonth = "10"
If cboMonth = "November" Then
cboMonth = "11"
If cboMonth = "December" Then
cboMonth = "12"
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
A = Mid(cboYear.Text, 3, 2) 'get 94 from 1994
strStartDate = Format("10/4/94", "dd/mm/yy")
strEndDate = Format("01 " & cboMonth & " " & cboYear, "dd/mm/yy")
If CDate(strStartDate) < CDate(strEndDate) Then
' txtDate.Text = "Select * " & "From Master " & "WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate
'Data1.RecordSource = "select from Master where DATE_OPENED '" & strStartDate & "' and '" & strEndDate
'Data1.RecordSource = txtDate.Text
' Data1.RecordSource = "SELECT (*) from MASTER WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate
'txtDate.Text = sql
'Data1.RecordSource = sql
'Data1.Recordset.MoveFirst
'Else
' txtDate.Text = "Records do not go back to: " & strEndDate
'End If
'If Data1.Recordset.NoMatch Then
'MsgBox "No such Auto Response Number in the PSR Database", vbOKOnly, "PSR Record Not Found"
Data1.Refresh
Data1.RecordSource = "SELECT from Master where DATE_OPENED between '" & "#" & strStartDate & "#" & "' and '" & "#" & strEndDate & "#"
Data1.Recordset.MoveNext
' If Data1.Recordset.NoMatch Then
' MsgBox "No such Auto Response Number in the PSR Database", vbOKOnly, "PSR Record Not Found"
Form2.MSFlexGrid1 = Data1.RecordSource
'Form3.Show
End If
End Sub