Hi
thought id attempt to do this, i have a field with the date format for exmple is 4/14/01
i want to make a search query using a form to find a particular date, but instead of typing in 4/14/01, i want to have 3 pull "month" "day" "year" and by selecting the combination, i get the date result in one field.
This is what ive tried so far, im notsure if im on the right track or totally off. This is just a test without using the pull downs but still using 3 text boxes.
Private Sub Search_Click()
Dim db As Database, rst As Recordset
Dim crdate, strsql
crdate = " = '" & Me!Month & Me!Day & Me!year & " '"
strsql = " Select * from [table1] where" _
& " [date] " & crdate & ""
Set db = CurrentDb()
Set rst = db.OpenRecordset(strsql, dbOpenDynaset)
If st.RecordCount < 1 Then
MsgBox "none", vbOKOnly, "try"
Exit Sub
Else: Forms![form1].RecordSource = strsql
End If
End Sub
table1 is my table, date is the field, and form1 is the form,
thx
thought id attempt to do this, i have a field with the date format for exmple is 4/14/01
i want to make a search query using a form to find a particular date, but instead of typing in 4/14/01, i want to have 3 pull "month" "day" "year" and by selecting the combination, i get the date result in one field.
This is what ive tried so far, im notsure if im on the right track or totally off. This is just a test without using the pull downs but still using 3 text boxes.
Private Sub Search_Click()
Dim db As Database, rst As Recordset
Dim crdate, strsql
crdate = " = '" & Me!Month & Me!Day & Me!year & " '"
strsql = " Select * from [table1] where" _
& " [date] " & crdate & ""
Set db = CurrentDb()
Set rst = db.OpenRecordset(strsql, dbOpenDynaset)
If st.RecordCount < 1 Then
MsgBox "none", vbOKOnly, "try"
Exit Sub
Else: Forms![form1].RecordSource = strsql
End If
End Sub
table1 is my table, date is the field, and form1 is the form,
thx