Hi All,
This may seem simple for you experts. I need to extract data from a table between two dates.
User will input a date and from that date +7 days data. Using Access 2007 and VB6.
Format is "mm/dd/yyyy".
Below is my code. I'm getting error message: "No value given for one or more required parameters"
This may seem simple for you experts. I need to extract data from a table between two dates.
User will input a date and from that date +7 days data. Using Access 2007 and VB6.
Format is "mm/dd/yyyy".
Below is my code. I'm getting error message: "No value given for one or more required parameters"
Code:
Private Sub Command2_Click()
Dim str As String
Public DOI As Date, tempd As Date
DOI = Format(Text1.Text, "mm/dd/yyyy")
tempd = DateAdd("d", 7, DOI)
tempd = Format(tempd, "mm/dd/yyyy")
Set rs = New ADODB.Recordset
str = "SELECT * from Travellers_report where Travellers_report.Return_Date >=DateValue('" & DOI & "') and Travellers_report.Return_Date <=DateValue('" & tempd & "');"
'Debug.Print str
rs.Open str, Con, 1, 2
temp = rs.RecordCount
MsgBox temp
End Sub