|
-
Apr 18th, 2000, 03:24 AM
#1
Thread Starter
Addicted Member
I have a text box that returns the syntax for a query. How do I then use this syntax to query the database. I can't seem to get it to work?
Here is my code:rivate 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 mmm yyyy")
strEndDate = Format("01 " & cboMonth & " " & cboYear, "dd mmm yyyy")
If CDate(strStartDate) < CDate(strEndDate) Then
txtDate.Text = "Select * " & "From Master " & "WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate
'Data1.RecordSource = txtDate.Text
'Data1.RecordSource = "SELECT (*) from MASTER WHERE DATE_OPENED BETWEEN '" & strStartDate & "' and '" & strEndDate = Form2.MSFlexGrid1
'txtDate.Text = sql
'Data1.RecordSource = sql
'Data1.Recordset.MoveFirst
Else
txtDate.Text = "Records do not go back to: " & strEndDate
End If
Form3.Show
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|