|
-
Apr 17th, 2000, 11:16 PM
#1
Thread Starter
Addicted Member
the below code returns the value of a text box with a text query. I need to be able to take the result and make it not a string but a query to query the database. How do I do this?
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
-
Apr 17th, 2000, 11:27 PM
#2
Fanatic Member
I am not sure of the syntax of the date for SQL queries, but when you probaly need to put " ' " marks around the string.
eg.
Code:
strStartDate = "'" & strStartDate & "'"
strEndDate = "'" & strEndDate & "'"
Iain, thats with an i by the way!
-
Apr 17th, 2000, 11:36 PM
#3
Thread Starter
Addicted Member
Im not sure what you mean; I already get a string as a return value; example: select from Master where Date_Opened between 09 May 2000 and 01 May 2000. But its just returned as text I need it to actually query.
-
Apr 17th, 2000, 11:43 PM
#4
Fanatic Member
You have to put # either side of dates in queries instead of '.
eg. #18/04/2000#
-
Apr 18th, 2000, 12:19 AM
#5
Thread Starter
Addicted Member
where are you saying to do this as the date is a variable
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
|